Beispiel #1
0
        public void TestNullValue_When_NullableType()
        {
            var ss = new SerializationServiceBuilder()
                     .Build();

            var output = ss.CreateObjectDataOutput(1024);

            ss.WriteObject(output, 1);
            ss.WriteObject(output, null);

            var input = ss.CreateObjectDataInput(output.ToByteArray());

            Assert.AreEqual(1, ss.ReadObject <int?>(input));
            Assert.IsNull(ss.ReadObject <int?>(input));
        }
Beispiel #2
0
        public void TestNullValue_When_ValueType()
        {
            var ss = new SerializationServiceBuilder()
                     .Build();

            var output = ss.CreateObjectDataOutput(1024);

            ss.WriteObject(output, null);

            var input = ss.CreateObjectDataInput(output.ToByteArray());

            ss.ReadObject <int>(input);
        }
        public void TestNullValue_When_ReferenceType()
        {
            var ss = new SerializationServiceBuilder(new NullLoggerFactory())
                     .Build();

            var output = ss.CreateObjectDataOutput(1024);

            ss.WriteObject(output, null);

            var input = ss.CreateObjectDataInput(output.ToByteArray());

            Assert.IsNull(ss.ReadObject <object>(input));
        }
        public void TestNullValue_When_ValueType()
        {
            Assert.Throws <SerializationException>(() =>
            {
                var ss = new SerializationServiceBuilder(new NullLoggerFactory())
                         .Build();

                var output = ss.CreateObjectDataOutput(1024);
                ss.WriteObject(output, null);

                var input = ss.CreateObjectDataInput(output.ToByteArray());
                ss.ReadObject <int>(input);
            });
        }