コード例 #1
0
        public void Component_ObjectContainsComplexLists_ResultIsTheSameAsInput()
        {
            //Arrange
            ClassWithConstructorPopulatingProperty
                testClass = _fixture.Create <ClassWithConstructorPopulatingProperty>();

            //Act
            var result       = AvroConvert.Serialize(testClass);
            var deserialized = AvroConvert.Deserialize <ClassWithConstructorPopulatingProperty>(result);

            //Assert
            Assert.NotNull(result);
            Assert.NotNull(deserialized);
            Assert.Equal(testClass.nestedList.Count, deserialized.nestedList.Count);
            Assert.Equal(testClass.stringProperty, deserialized.stringProperty);
            Assert.Equal(testClass, deserialized);
        }
コード例 #2
0
        public void Component_ObjectContainsEmptyList_ResultIsTheSameAsInput()
        {
            //Arrange
            ClassWithConstructorPopulatingProperty testClass = new ClassWithConstructorPopulatingProperty();


            //Act
            var result = AvroConvert.Serialize(testClass);

            var deserialized = AvroConvert.Deserialize <ClassWithConstructorPopulatingProperty>(result);


            //Assert
            Assert.NotNull(result);
            Assert.NotNull(deserialized);
            Assert.Equal(testClass, deserialized);
        }
コード例 #3
0
        public void Component_ObjectContainsEmptyList_ResultIsTheSameAsInput()
        {
            //Arrange
            ClassWithConstructorPopulatingProperty testClass = new ClassWithConstructorPopulatingProperty();


            //Act
            var result       = AvroConvert.Serialize(testClass);
            var deserialized = AvroConvert.Deserialize <ClassWithConstructorPopulatingProperty>(result);


            //Assert
            Assert.NotNull(result);
            Assert.NotNull(deserialized);
            Assert.Equal(testClass.anotherList, deserialized.anotherList);
            Assert.Equal(testClass.nestedList, deserialized.nestedList);
            Assert.True(Comparison.AreEqual(testClass.stringProperty, deserialized.stringProperty));
        }