This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed
tests/ServiceStack.Text.Tests Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 280280 <Compile Include =" UseCases\StripeJsonData.cs" />
281281 <Compile Include =" UseCases\StripeGateway.cs" />
282282 <Compile Include =" UseCases\StripeSerializationTests.cs" />
283+ <Compile Include =" UseCases\ServiceStack_Text_UseCase.cs" />
283284 <Compile Include =" Utils\DateTimeSerializerTests.cs" />
284285 <Compile Include =" Support\DdnDtos.cs" />
285286 <Compile Include =" DdnDtoTests.cs" />
Original file line number Diff line number Diff line change 1+ using System . Collections . Generic ;
2+ using System . Diagnostics ;
3+ using System . IO ;
4+ using NUnit . Framework ;
5+
6+ namespace ServiceStack . Text . Tests . UseCases
7+ {
8+ public class GithubRepository
9+ {
10+ public string Name { get ; set ; }
11+ public string Description { get ; set ; }
12+ public string Url { get ; set ; }
13+ public string Homepage { get ; set ; }
14+ public string Language { get ; set ; }
15+ public int Watchers { get ; set ; }
16+ public int Forks { get ; set ; }
17+ }
18+
19+ [ TestFixture ]
20+ public class ServiceStack_Text_UseCase
21+ {
22+ [ Test , Explicit ]
23+ public void Dump_and_Write_GitHub_Organization_Repos_to_CSV ( )
24+ {
25+ var orgName = "ServiceStack" ;
26+
27+ var orgRepos = "https://api.github.com/orgs/{0}/repos" . Fmt ( orgName )
28+ . GetJsonFromUrl ( httpReq => httpReq . UserAgent = "ServiceStack.Text" )
29+ . FromJson < List < GithubRepository > > ( ) ;
30+
31+ "Writing {0} Github Repositories:" . Print ( orgName ) ;
32+ orgRepos . PrintDump ( ) ; //recursive, pretty-format dump of any C# POCOs
33+
34+ var csvFilePath = "~/{0}-repos.csv" . Fmt ( orgName ) . MapAbsolutePath ( ) ;
35+ File . WriteAllText ( csvFilePath , orgRepos . ToCsv ( ) ) ;
36+
37+ Process . Start ( csvFilePath ) ;
38+ }
39+ }
40+ }
Original file line number Diff line number Diff line change @@ -77,8 +77,7 @@ public TestModel()
7777 public void Can_DumpModel ( )
7878 {
7979 var model = new TestModel ( ) ;
80- Console . WriteLine ( model . Dump ( ) ) ;
80+ model . PrintDump ( ) ;
8181 }
82-
8382 }
8483}
You can’t perform that action at this time.
0 commit comments