当前位置: 首页>>代码示例>>C#>>正文


C# SerializationTestContext类代码示例

本文整理汇总了C#中SerializationTestContext的典型用法代码示例。如果您正苦于以下问题:C# SerializationTestContext类的具体用法?C# SerializationTestContext怎么用?C# SerializationTestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SerializationTestContext类属于命名空间,在下文中一共展示了SerializationTestContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadCollectionOfDictionaryTest

 public void ReadCollectionOfDictionaryTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertRead<CollectionOfDictionaryGraph>(3);
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.DictionaryInCollection, LevelType.DictionaryKey,
         LevelType.DictionaryValue, LevelType.DictionaryKey, LevelType.DictionaryInCollection);
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:7,代码来源:ReadValuePropertyTests.cs

示例2: ReadCollectionOfComplexTest

 public void ReadCollectionOfComplexTest()
 {
     var context = new SerializationTestContext();
     var stats = context.AssertRead<CollectionOfComplexGraph>(4);
     stats.AssertVisitOrderExact(LevelType.Collection, LevelType.CollectionItem, LevelType.Value, LevelType.Value,
         LevelType.Value, LevelType.Value, LevelType.CollectionItem);
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:7,代码来源:ReadValuePropertyTests.cs

示例3: WriteBlobTest

        public void WriteBlobTest()
        {
            var graph = new BlobGraph {Value = new byte[] {1, 2, 3}};
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.IsTrue(graph.Value.SequenceEqual(actual.Value));
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:9,代码来源:PackedDataSerializerGraphTests.cs

示例4: 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);
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:9,代码来源:WriteValuePropertyTests.cs

示例5: 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);
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:10,代码来源:WriteValuePropertyTests.cs

示例6: IdentifierTest

        public void IdentifierTest()
        {
            var graph = new Identifier { Id = 1, Type = ApplicationType.Api };

            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual);
            Assert.AreEqual(graph.Id, actual.Id);
            Assert.AreEqual(graph.Type, actual.Type);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:11,代码来源:PackedDataSerializerDataTests.cs

示例7: 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);
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:11,代码来源:WriteValuePropertyTests.cs

示例8: WriteDynamicTravelTest

        public void WriteDynamicTravelTest()
        {
            var context = new SerializationTestContext();

            var bytes = context.Pack(DataBlock.Filled());
            Assert.IsNotNull(bytes);
            Assert.IsTrue(bytes.Length > 0);
            var hex = "0x" + string.Join("", bytes.Select(b => b.ToString("X")));
            Assert.IsNotNull(hex);
            var expected = SerializationTestContext.GetFilledDataBlockHexString();
            Assert.AreEqual(expected, hex);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:12,代码来源:PackedDataWriteVisitorTests.cs

示例9: WriteCollectionOfComplexTest

        public void WriteCollectionOfComplexTest()
        {
            var graph = new CollectionOfComplexGraph {
                Value = new List<Relation> { new Relation { Id = Guid.Empty, Name = "Test", Value = 1 } }
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.AreEqual(1, actual.Value.Count);

            for (var i = 0; i < graph.Value.Count; i++) {
                var expectedValue = graph.Value[i];
                var actualValue = actual.Value[i];
                Assert.AreEqual(expectedValue, actualValue);
            }
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:17,代码来源:PackedDataSerializerGraphTests.cs

示例10: WriteAndReadNullableValuesTest

        public void WriteAndReadNullableValuesTest()
        {
            var graph = new NullableValuesEntity {
                Id = 1,
                MayBool = null,
                MayDateTime = null,
                MayInt = 44,
                MayTimeSpan = new TimeSpan(22, 30, 10)
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual);
            Assert.AreEqual(1, actual.Id);
            Assert.IsNull(actual.MayBool);
            Assert.IsNull(actual.MayDateTime);
            Assert.AreEqual(44, actual.MayInt);
            Assert.AreEqual(new TimeSpan(22, 30, 10), actual.MayTimeSpan);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:19,代码来源:PackedDataSerializerDataTests.cs

示例11: ValueDictionaryTest

        public void ValueDictionaryTest()
        {
            var graph = new ValueDictionary {
                Test = new Dictionary<string, int> {
                    {"Test1", 1},
                    {"Test2", 2},
                    {"Test3", 3},
                }
            };

            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Test);
            Assert.AreEqual(3, actual.Test.Count);

            Assert.IsTrue(graph.Test.SequenceEqual(actual.Test, new ValueDictionaryComparer()));
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:19,代码来源:PackedDataSerializerDataTests.cs

示例12: ComplexDictionaryTest

        public void ComplexDictionaryTest()
        {
            var graph = new ComplexDictionary {
                Test = 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"}}
                }
            };

            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual);
            Assert.IsNotNull(actual.Test);
            Assert.AreEqual(3, actual.Test.Count);

            Assert.IsTrue(graph.Test.Keys.SequenceEqual(actual.Test.Keys));
            Assert.IsTrue(graph.Test.Values.SequenceEqual(actual.Test.Values));
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:20,代码来源:PackedDataSerializerDataTests.cs

示例13: WriteCollectionOfCollectionTest

        public void WriteCollectionOfCollectionTest()
        {
            var graph = new CollectionOfCollectionGraph {
                Value = new List<List<string>> {
                    new List<string> {"Test"}
                }
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.AreEqual(1, actual.Value.Count);

            for (var i = 0; i < graph.Value.Count; i++) {
                var expectedValue = graph.Value[i];
                var actualValue = actual.Value[i];
                Assert.AreEqual(1, actualValue.Count);

                var firstExpected = expectedValue.First();
                var firstActual = actualValue.First();

                Assert.AreEqual(firstExpected, firstActual);
            }
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:24,代码来源:PackedDataSerializerGraphTests.cs

示例14: WriteCollectionOfDictionaryTest

        public void WriteCollectionOfDictionaryTest()
        {
            var graph = new CollectionOfDictionaryGraph {
                Value = new List<Dictionary<string, int>> {
                    new Dictionary<string, int> {{"Test", 42}}
                }
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.AreEqual(1, actual.Value.Count);

            for (var i = 0; i < graph.Value.Count; i++) {
                var expectedValue = graph.Value[i];
                var actualValue = actual.Value[i];
                Assert.AreEqual(1, actualValue.Count);

                var firstExpected = expectedValue.First();
                var firstActual = actualValue.First();

                Assert.AreEqual(firstExpected.Key, firstActual.Key);
                Assert.AreEqual(firstExpected.Value, firstActual.Value);
            }
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:25,代码来源:PackedDataSerializerGraphTests.cs

示例15: WriteDictionaryTest

        public void WriteDictionaryTest()
        {
            var graph = new DictionaryGraph {Value = new Dictionary<int, string> {{2, "Test"}}};
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.AreEqual(1, actual.Value.Count);

            var firstActual = actual.Value.First();
            Assert.AreEqual(2, firstActual.Key);
            Assert.AreEqual("Test", firstActual.Value);
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:13,代码来源:PackedDataSerializerGraphTests.cs


注:本文中的SerializationTestContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。