Esempio n. 1
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));
        }
        public void Component_ObjectWithNulls_ResultIsTheSameAsInput()
        {
            //Arrange
            User user = new User();

            user.name            = "Krzys";
            user.favorite_color  = null;
            user.favorite_number = null;

            //Act
            var serialized   = AvroConvert.Serialize(user);
            var deserialized = AvroConvert.Deserialize <User>(serialized);

            //Assert
            Assert.NotNull(serialized);
            Assert.NotNull(deserialized);
            Assert.Equal(user.name, deserialized.name);
            Assert.True(Comparison.AreEqual(user.favorite_color, deserialized.favorite_color));
            Assert.Equal(user.favorite_number, deserialized.favorite_number);
        }