コード例 #1
0
        public void Serialize_InputIsArray_NoExceptionIsThrown()
        {
            //Arrange
            SomeTestClass someTestClass = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "spoko",
                    andLongProperty  = 2137
                },
                simpleProperty = 111111
            };

            SomeTestClass dupa2 = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "loko",
                    andLongProperty  = 2137
                },
                simpleProperty = 2135
            };

            SomeTestClass[] someTestClasses = new SomeTestClass[2];
            someTestClasses[0] = someTestClass;
            someTestClasses[1] = dupa2;

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

            //Assert
            Assert.NotNull(result);
        }
コード例 #2
0
        public void SerializeList_ThenDeserialize_ListsAreEqual()
        {
            //Arrange
            SomeTestClass someTestClass = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "spoko",
                    andLongProperty  = 2137
                },
                simpleProperty = 111111
            };

            SomeTestClass dupa2 = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "loko",
                    andLongProperty  = 2137
                },
                simpleProperty = 2135
            };

            SomeTestClass[] someTestClasses = new SomeTestClass[2];
            someTestClasses[0] = someTestClass;
            someTestClasses[1] = dupa2;

            //Act
            var serialized   = AvroConvert.Serialize(someTestClasses);
            var deserialized = AvroConvert.Deserialize <List <SomeTestClass> >(serialized);

            //Assert
            Assert.NotNull(deserialized);
        }
コード例 #3
0
        public void Serialize_InputIsList_NoExceptionIsThrown()
        {
            //Arrange
            SomeTestClass someTestClass = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "spoko",
                    andLongProperty  = 2137
                },
                simpleProperty = 111111
            };

            SomeTestClass someTestClass2 = new SomeTestClass
            {
                objectProperty = new NestedTestClass
                {
                    justSomeProperty = "loko",
                    andLongProperty  = 2137
                },
                simpleProperty = 2135
            };

            List <SomeTestClass> someTestClasses = new List <SomeTestClass>();

            someTestClasses.Add(someTestClass);
            someTestClasses.Add(someTestClass2);

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

            //Assert
            Assert.NotNull(result);
        }