Пример #1
0
        public void IntegerArray_EmptyArrayTest()
        {
            var machine = GetSerializer <ClassWithNumericArrays>();
            var source  = new ClassWithNumericArrays {
                IntArrayValue = new int[0]
            };
            string packed   = machine.Serialize(source);
            var    unpacked = machine.Deserialize(packed);

            unpacked.Should().NotBeNull();
            unpacked.IntArrayValue.Should().BeEmpty();
        }
Пример #2
0
        public void DecimalArray_MultiElementArrayTest()
        {
            var machine = GetSerializer <ClassWithNumericArrays>();
            var source  = new ClassWithNumericArrays {
                DecimalArrayValue = new decimal[] { 2.4m, 8.16m, 32.64m }
            };
            string packed   = machine.Serialize(source);
            var    unpacked = machine.Deserialize(packed);

            unpacked.Should().NotBeNull();
            unpacked.DecimalArrayValue.Should().Equal(new decimal[] { 2.4m, 8.16m, 32.64m });
        }
Пример #3
0
        public void IntegerArray_SingleElementArrayTest()
        {
            var machine = GetSerializer <ClassWithNumericArrays>();
            var source  = new ClassWithNumericArrays {
                IntArrayValue = new int[] { 42 }
            };
            string packed   = machine.Serialize(source);
            var    unpacked = machine.Deserialize(packed);

            unpacked.Should().NotBeNull();
            unpacked.IntArrayValue.Should().Equal(new int[] { 42 });
        }