Esempio n. 1
0
        public void TestingStructStructSimple(TestStructSimple init)
        {
            ResetBois();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestStructSimple>(TestStream);

            SerializeAreEqual(init, final);
        }
Esempio n. 2
0
        public void TestingObjectSelfReferencing(TestObjectSelfReferencing init)
        {
            ResetBois();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestObjectSelfReferencing>(TestStream);

            SerializeAreEqual(init, final);
        }
Esempio n. 3
0
        public void TestingStructSelfReferencing(TestStructPrimitives init)
        {
            ResetBois();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestStructPrimitives>(TestStream);

            SerializeAreEqual(init, final);
        }
Esempio n. 4
0
        public void TestingStructComplex(TestStructComplex init)
        {
            ResetBois();

            BoisSerializer.Initialize <TestStructComplex>();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestStructComplex>(TestStream);

            SerializeAreEqual(init, final);
        }
Esempio n. 5
0
        public void TestingObjectPrimitiveTypes(TestObjectPrimitiveTypes init)
        {
            ResetBois();

            //BoisSerializer.Initialize<TestObjectPrimitiveTypes>();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestObjectPrimitiveTypes>(TestStream);

            SerializeAreEqual(init, final);
        }
Esempio n. 6
0
        public void TestingArrays(Array init)
        {
            ResetBois();

            BoisSerializer.Initialize(init.GetType());


            var arrayType = init.GetType();

            Bois.Serialize(init, arrayType, TestStream);
            ResetStream();

            var final = Bois.Deserialize(TestStream, arrayType);

            SerializeAreEqual(init, final);
        }
Esempio n. 7
0
        public void TestCollectionsPrimitive(TestObjectCollectionsPrimitive testObject)
        {
            ResetBois();

            Bois.Serialize(testObject, TestStream);
            ResetStream();

            var final = Bois.Deserialize <TestObjectCollectionsPrimitive>(TestStream);

            // ConcurrentBag's items are never in order, had to order them for this test to pass
            testObject.ConcurrentBag      = new ConcurrentBag <int>(testObject.ConcurrentBag.OrderBy(c => c));
            testObject.ConcurrentBagField = new ConcurrentBag <int?>(testObject.ConcurrentBagField.OrderBy(c => c));
            final.ConcurrentBag           = new ConcurrentBag <int>(final.ConcurrentBag.OrderBy(c => c));
            final.ConcurrentBagField      = new ConcurrentBag <int?>(final.ConcurrentBagField.OrderBy(c => c));

            SerializeAreEqual(testObject, final);
        }
Esempio n. 8
0
        public void TestGenericCollection_Simple_int()
        {
            var init = new List <int>()
            {
                10,
                20,
                500
            };

            ResetBois();

            BoisSerializer.Initialize <List <int> >();

            Bois.Serialize(init, TestStream);
            ResetStream();

            var final = Bois.Deserialize <List <int> >(TestStream);

            init.Should().BeEquivalentTo(final);
        }