• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SerializationTestContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WriteUInt64Test

 public void WriteUInt64Test()
 {
     var context = new SerializationTestContext();
     context.AssertBinarySingleProperty(new UInt64Graph { Value = 42 });
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:5,代码来源:PackedDataSerializerGraphTests.cs


示例17: WriteTimeSpanTest

 public void WriteTimeSpanTest()
 {
     var context = new SerializationTestContext();
     context.AssertBinarySingleProperty(new TimeSpanGraph { Value = new TimeSpan(12, 30, 00) });
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:5,代码来源:PackedDataSerializerGraphTests.cs


示例18: WriteStringTest

 public void WriteStringTest()
 {
     var context = new SerializationTestContext();
     context.AssertBinarySingleProperty(new StringGraph { Value = "Hello World" });
 }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:5,代码来源:PackedDataSerializerGraphTests.cs


示例19: WriteDictionaryWithComplexKeyTest

        public void WriteDictionaryWithComplexKeyTest()
        {
            var graph = 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"}
                }
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

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

            foreach (var kv in graph.Value) {
                var actualValue = actual.Value[kv.Key];
                Assert.AreEqual(kv.Value, actualValue);
            }
        }
开发者ID:jaygumji,项目名称:EnigmaDb,代码行数:20,代码来源:PackedDataSerializerGraphTests.cs


示例20: WriteJaggedArrayTest

        public void WriteJaggedArrayTest()
        {
            var graph = new JaggedArrayGraph {
                Value = new[] { new[] { 5, 2, 3 }, new[] { 1, 2, 3 } }
            };
            var context = new SerializationTestContext();
            var actual = context.SerializeAndDeserialize(graph);

            Assert.IsNotNull(actual.Value);
            Assert.AreEqual(graph.Value.Length, actual.Value.Length);

            for (var r0 = 0; r0 < graph.Value.Length; r0++) {
                var expectedInner = graph.Value[r0];
                var actualInner = graph.Value[r0];
                Assert.AreEqual(expectedInner.Length, actualInner.Length);
                for (var r1 = 0; r1 < expectedInner.Length; r1++) {
                    var expectedValue = expectedInner[r1];
                    var actualValue = actualInner[r1];

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SerializationWriter类代码示例发布时间:2022-05-24
下一篇:
C# SerializationReader类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap