private void TestByteSerialization(SpecCase x)
 {
     var stream = new ByteStream(0, true);
     var a = new ItemCountDefinition() {
         TypeName = "some type",
         SubtypeName = "some subtype",
         Count = 47
     };
     a.AddToByteSteam(stream);
     stream = new ByteStream(stream.Data, stream.Data.Length);
     var a2 = new ItemCountDefinition(stream);
     x.Assert(a2.TypeName == "some type",
         "Name serializes/deserializes correctly.");
     x.Assert(a2.SubtypeName == "some subtype",
         "SubtypeName serializes/deserializes correctly.");
     x.Assert(a2.Count == 47,
         "Count serializes/deserializes correctly.");
 }
 private void TestByteSerialization(SpecCase x)
 {
     var stream = new ByteStream(0, true);
     var a = new ItemCountAggregateDefinition() {
         Counts = new List<ItemCountDefinition>() {
             new ItemCountDefinition() {
                 TypeName = "type 1"
             },
             new ItemCountDefinition() {
                 TypeName = "type 2"
             }
         }
     };
     //Log.Trace("serializing", "TestByteSerialization");
     a.AddToByteSteam(stream);
     stream = new ByteStream(stream.Data, stream.Data.Length);
     //Log.Trace("deserializing", "TestByteSerialization");
     var a2 = new ItemCountAggregateDefinition(stream);
     x.Assert(a2.Counts[0].TypeName == "type 1",
         "First item serializes/deserializes correctly.");
     x.Assert(a2.Counts[1].TypeName == "type 2",
         "Second item serializes/deserializes correctly.");
 }