Exemplo n.º 1
0
 public void WriteCollectionOfComplexTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(4, new CollectionOfComplexGraph {
         Value = new List<Relation> {new Relation {Id = Guid.Empty, Name = "Test", Value = 1}}
     });
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.CollectionItem, LevelType.Value, LevelType.Value,
         LevelType.Value, LevelType.Value);
 }
Exemplo n.º 2
0
 public void WriteCollectionOfCollectionTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(1, new CollectionOfCollectionGraph {
         Value = new List<List<string>> {
             new List<string> {"Test"}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.CollectionInCollection, LevelType.CollectionItem);
 }
Exemplo n.º 3
0
 public void WriteCollectionOfDictionaryTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(2, new CollectionOfDictionaryGraph {
         Value = new List<Dictionary<string, int>> {
             new Dictionary<string, int> {{"Test", 42}}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.DictionaryInCollection, LevelType.DictionaryKey,
         LevelType.DictionaryValue);
 }
Exemplo n.º 4
0
 public void WriteDictionaryTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(2, new DictionaryGraph { Value = new Dictionary<int, string> { {2, "Test"}}});
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey, LevelType.DictionaryValue);
 }
Exemplo n.º 5
0
 public void WriteMultidimensionalArrayTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(6, new MultidimensionalArrayGraph {
         Value = new[,] {{5, 2, 3}, {1, 2, 3}}
     });
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.CollectionInCollection, LevelType.CollectionItem,
         LevelType.CollectionItem, LevelType.CollectionItem, LevelType.CollectionInCollection,
         LevelType.CollectionItem, LevelType.CollectionItem, LevelType.CollectionItem);
 }
Exemplo n.º 6
0
 public void WriteDictionaryWithDictionaryValueTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(3, new DictionaryWithDictionaryValueGraph {
         Value = new Dictionary<string, Dictionary<int, string>> {
             {"X", new Dictionary<int, string> {{42, "No 42"}}}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey,
         LevelType.DictionaryInDictionaryValue, LevelType.DictionaryKey, LevelType.DictionaryValue);
 }
Exemplo n.º 7
0
 public void WriteJaggedArrayTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(6, new JaggedArrayGraph {
         Value = new[] { new []{5, 2, 3}, new []{1, 2, 3} }
     });
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.CollectionInCollection, LevelType.CollectionItem,
         LevelType.CollectionItem, LevelType.CollectionItem, LevelType.CollectionInCollection,
         LevelType.CollectionItem, LevelType.CollectionItem, LevelType.CollectionItem);
 }
Exemplo n.º 8
0
 public void WriteDictionaryWithComplexValueTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(12, new DictionaryWithComplexValueGraph {
         Value = new Dictionary<string, Category> {
             {"A", new Category {Name = "Warning", Description = "Warning of something", Image = new byte[]{1, 2, 3, 4, 5}}},
             {"B", new Category {Name = "Error", Description = "Error of something", Image = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9}}},
             {"C", new Category {Name = "Temporary"}}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey, LevelType.DictionaryValue,
         LevelType.Value, LevelType.Value, LevelType.Value, LevelType.DictionaryKey, LevelType.DictionaryValue,
         LevelType.Value, LevelType.Value, LevelType.Value, LevelType.DictionaryKey, LevelType.DictionaryValue,
         LevelType.Value, LevelType.Value, LevelType.Value);
 }
Exemplo n.º 9
0
 public void WriteDictionaryWithComplexKeyTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(9, new DictionaryWithComplexKeyGraph {
         Value = new Dictionary<Identifier, string> {
             {new Identifier {Id = 1, Type = ApplicationType.Api}, "A"},
             {new Identifier {Id = 2, Type = ApplicationType.Api}, "B"},
             {new Identifier {Id = 3, Type = ApplicationType.Service}, "C"}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey, LevelType.Value, LevelType.Value,
         LevelType.DictionaryValue, LevelType.DictionaryKey, LevelType.Value, LevelType.Value,
         LevelType.DictionaryValue, LevelType.DictionaryKey, LevelType.Value, LevelType.Value,
         LevelType.DictionaryValue);
 }
Exemplo n.º 10
0
 public void WriteDictionaryWithComplexKeyAndValueTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(15, new DictionaryWithComplexKeyAndValueGraph {
         Value = new Dictionary<Identifier, Category> {
             {new Identifier {Id = 1, Type = ApplicationType.Api}, new Category {Name = "Warning", Description = "Warning of something", Image = new byte[]{1, 2, 3, 4, 5}}},
             {new Identifier {Id = 2, Type = ApplicationType.Api}, new Category {Name = "Error", Description = "Error of something", Image = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9}}},
             {new Identifier {Id = 3, Type = ApplicationType.Service}, new Category {Name = "Temporary"}}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey, LevelType.Value, LevelType.Value,
         LevelType.DictionaryValue, LevelType.Value, LevelType.Value, LevelType.Value, LevelType.DictionaryKey,
         LevelType.Value, LevelType.Value, LevelType.DictionaryValue, LevelType.Value, LevelType.Value,
         LevelType.Value, LevelType.DictionaryKey, LevelType.Value, LevelType.Value, LevelType.DictionaryValue,
         LevelType.Value, LevelType.Value, LevelType.Value);
 }
Exemplo n.º 11
0
 public void WriteDictionaryWithCollectionValueTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(2, new DictionaryWithCollectionValueGraph {
         Value = new Dictionary<string, List<int>> {
             {"X", new List<int> {42}}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.DictionaryKey,
         LevelType.CollectionInDictionaryValue, LevelType.CollectionItem);
 }
Exemplo n.º 12
0
 public void WriteDictionaryWithCollectionKeyTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertWrite(2, new DictionaryWithCollectionKeyGraph {
         Value = new Dictionary<List<int>, string> {
             {new List<int> {42}, "Hello World"}
         }
     });
     stats.AssertVisitOrderExact(LevelType.Dictionary, LevelType.CollectionInDictionaryKey,
         LevelType.CollectionItem, LevelType.DictionaryValue);
 }