@@ -21,6 +21,7 @@ public class JsonApiMediaFormaterTests
2121 Author a ;
2222 Post p , p2 , p3 , p4 ;
2323 Sample s1 , s2 ;
24+ Tag t1 , t2 , t3 ;
2425
2526 private class MockErrorSerializer : IErrorSerializer
2627 {
@@ -54,6 +55,19 @@ public void SetupModels()
5455 Name = "Jason Hater" ,
5556 } ;
5657
58+ t1 = new Tag {
59+ Id = 1 ,
60+ Text = "Ember"
61+ } ;
62+ t2 = new Tag {
63+ Id = 2 ,
64+ Text = "React"
65+ } ;
66+ t3 = new Tag {
67+ Id = 3 ,
68+ Text = "Angular"
69+ } ;
70+
5771 p = new Post ( )
5872 {
5973 Id = 1 ,
@@ -234,8 +248,7 @@ public void SerializeArrayIntegrationTest()
234248
235249 [ TestMethod ]
236250 [ DeploymentItem ( @"Data\AttributeSerializationTest.json" ) ]
237- public void Serializes_attributes_properly ( )
238- {
251+ public void Serializes_attributes_properly ( ) {
239252 // Arrang
240253 JsonApiFormatter formatter = new JsonApiFormatter ( new PluralizationService ( ) ) ;
241254 MemoryStream stream = new MemoryStream ( ) ;
@@ -250,6 +263,23 @@ public void Serializes_attributes_properly()
250263 Assert . AreEqual ( expected , output . Trim ( ) ) ;
251264 }
252265
266+ [ TestMethod ]
267+ [ DeploymentItem ( @"Data\ByteIdSerializationTest.json" ) ]
268+ public void Serializes_byte_ids_properly ( ) {
269+ // Arrang
270+ JsonApiFormatter formatter = new JsonApiFormatter ( new PluralizationService ( ) ) ;
271+ MemoryStream stream = new MemoryStream ( ) ;
272+
273+ // Act
274+ formatter . WriteToStreamAsync ( typeof ( Tag ) , new [ ] { t1 , t2 , t3 } , stream , null , null ) ;
275+
276+ // Assert
277+ string output = System . Text . Encoding . ASCII . GetString ( stream . ToArray ( ) ) ;
278+ Trace . WriteLine ( output ) ;
279+ var expected = JsonHelpers . MinifyJson ( File . ReadAllText ( "ByteIdSerializationTest.json" ) ) ;
280+ Assert . AreEqual ( expected , output . Trim ( ) ) ;
281+ }
282+
253283 [ TestMethod ]
254284 [ DeploymentItem ( @"Data\ReformatsRawJsonStringWithUnquotedKeys.json" ) ]
255285 public void Reformats_raw_json_string_with_unquoted_keys ( )