コード例 #1
0
        public virtual void TestPreDefinedDifferentVersionsWithNullInnerPortable()
        {
            var serializationService = PortableSerializationTest.CreateSerializationService(1);

            serializationService.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition(1));
            var serializationService2 = PortableSerializationTest.CreateSerializationService(2);

            serializationService2.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition(2));
            var mainWithNullInner = new MainPortable(unchecked (113), true, 'x', -500, 56789, -50992225L, 900.5678f,
                                                     -897543.3678909d, "this is main portable object created for testing!", null);

            TestPreDefinedDifferentVersions(serializationService, serializationService2, mainWithNullInner);
        }
コード例 #2
0
        internal static IClassDefinition CreateInnerPortableClassDefinition(int portableVersion)
        {
            var builder = new ClassDefinitionBuilder(FactoryId, SerializationTestsConstants.INNER_PORTABLE, portableVersion);

            builder.AddByteArrayField("b");
            builder.AddCharArrayField("c");
            builder.AddShortArrayField("s");
            builder.AddIntArrayField("i");
            builder.AddLongArrayField("l");
            builder.AddFloatArrayField("f");
            builder.AddDoubleArrayField("d");
            builder.AddPortableArrayField("nn", PortableSerializationTest.CreateNamedPortableClassDefinition(portableVersion));

            return(builder.Build());
        }
コード例 #3
0
        public virtual void TestPreDefinedDifferentVersionsWithInnerPortable()
        {
            var serializationService = PortableSerializationTest.CreateSerializationService(1);

            serializationService.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition(1));
            var serializationService2 = PortableSerializationTest.CreateSerializationService(2);

            serializationService2.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition(2));
            var nn = new NamedPortable[1];

            nn[0] = new NamedPortable("name", 123);
            var inner = new InnerPortable(new byte[] { 0, 1, 2 }, new[] { 'c', 'h', 'a', 'r' }, new short[] { 3, 4, 5 },
                                          new[] { 9, 8, 7, 6 }, new long[] { 0, 1, 5, 7, 9, 11 }, new[] { 0.6543f, -3.56f, 45.67f }, new[]
            {
                456.456
                , 789.789, 321.321
            }, nn);
            var mainWithInner = new MainPortable(unchecked (113), true, 'x', -500, 56789, -50992225L, 900.5678f,
                                                 -897543.3678909d, "this is main portable object created for testing!", inner);

            TestPreDefinedDifferentVersions(serializationService, serializationService2, mainWithInner);
        }