File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
test/CollectionJson.Client.Tests Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,9 @@ public Collection()
3838
3939 [ DataMember ( Name = "template" ) ]
4040 public Template Template { get ; private set ; }
41+
42+ [ DataMember ( Name = "error" ) ]
43+ public Error Error { get ; set ; }
4144 }
4245
4346}
Original file line number Diff line number Diff line change 1414 <copyright >2013 Glenn Block</copyright >
1515 <tags >collectionjson</tags >
1616 </metadata >
17+ <dependencies >
18+ <dependency id =" DynamicUtils" version =" 1.0.1" />
19+ </dependencies >
1720 <files >
1821 <file src =" bin\Release\CollectionJson.dll" target =" lib\portable-net40+sl50+win8+wpa81+wp8+monotouch+monoandroid" />
1922 </files >
Original file line number Diff line number Diff line change @@ -23,5 +23,26 @@ public async void WhenCreatingCollectionJsonContentObjectIsSerializedToCollectio
2323 var json = reader . ReadToEnd ( ) ;
2424 json . ShouldContain ( "\" collection\" " ) ;
2525 }
26+
27+ [ Fact ]
28+ public async void WhenCreatingCollectionJsonContentWithErrorObjectIsSerializedWithError ( )
29+ {
30+ var coll = new Collection ( )
31+ {
32+ Error = new Error ( )
33+ {
34+ Code = "1234" ,
35+ Message = "Hello world" ,
36+ Title = "An error occurred"
37+ }
38+ } ;
39+ var content = new CollectionJsonContent ( coll ) ;
40+ var stream = new MemoryStream ( ) ;
41+ await content . CopyToAsync ( stream ) ;
42+ var reader = new StreamReader ( stream ) ;
43+ stream . Position = 0 ;
44+ var json = reader . ReadToEnd ( ) ;
45+ json . ShouldContain ( "\" error\" " ) ;
46+ }
2647 }
2748}
You can’t perform that action at this time.
0 commit comments