コード例 #1
0
        public void ShouldDeserialize_CustomCollectionWithIndexer()
        {
            var test = new CustomCollectionObject(100, 200);

            test.Add("test", 1);
            test.Add("test 2", 2);
            var provider         = new SerializerProvider();
            var bytes            = provider.Serialize(test);
            var deserializedTest = provider.Deserialize <CustomCollectionObject>(bytes);

            Assert.AreEqual(test, deserializedTest);
        }
コード例 #2
0
        public static void Should_Clone_CustomCollectionObject()
        {
            var original = new CustomCollectionObject <BasicObject>(100, "test")
            {
                new BasicObject()
                {
                    IntValue = 1, BoolValue = true, ByteValue = 10, LongValue = 100, StringValue = "Test 1"
                },
                new BasicObject()
                {
                    IntValue = 2, BoolValue = false, ByteValue = 20, LongValue = 200, StringValue = "Test 2"
                },
                new BasicObject()
                {
                    IntValue = 3, BoolValue = true, ByteValue = 30, LongValue = 300, StringValue = "Test 3"
                }
            };
            CustomCollectionObject <BasicObject> cloned = original.Clone();

            cloned.ShouldBe(original);
        }
コード例 #3
0
        public void Should_Clone_CustomCollectionObject()
        {
            var original = new CustomCollectionObject <BasicObject>(100, "test")
            {
                new BasicObject()
                {
                    IntValue = 1, BoolValue = true, ByteValue = 10, LongValue = 100, StringValue = "Test 1"
                },
                new BasicObject()
                {
                    IntValue = 2, BoolValue = false, ByteValue = 20, LongValue = 200, StringValue = "Test 2"
                },
                new BasicObject()
                {
                    IntValue = 3, BoolValue = true, ByteValue = 30, LongValue = 300, StringValue = "Test 3"
                }
            };
            var cloned = original.Clone();

            Assert.AreEqual(original, cloned);
        }