本文整理汇总了C#中SerializationTestContext.AssertWrite方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationTestContext.AssertWrite方法的具体用法?C# SerializationTestContext.AssertWrite怎么用?C# SerializationTestContext.AssertWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationTestContext
的用法示例。
在下文中一共展示了SerializationTestContext.AssertWrite方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteCollectionOfComplexTest
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);
}
示例2: WriteCollectionOfCollectionTest
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);
}
示例3: WriteCollectionOfDictionaryTest
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);
}
示例4: WriteDictionaryTest
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);
}
示例5: WriteMultidimensionalArrayTest
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);
}
示例6: WriteDictionaryWithDictionaryValueTest
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);
}
示例7: WriteJaggedArrayTest
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);
}
示例8: WriteDictionaryWithComplexValueTest
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);
}
示例9: WriteDictionaryWithComplexKeyTest
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);
}
示例10: WriteDictionaryWithComplexKeyAndValueTest
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);
}
示例11: WriteDictionaryWithCollectionValueTest
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);
}
示例12: WriteDictionaryWithCollectionKeyTest
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);
}