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);
        }
Ejemplo n.º 2
0
        public virtual void TestPreDefinedDifferentVersionsWithInnerPortable()
        {
            var serializationService = PortableSerializationTest.CreateSerializationService(1);

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

            serializationService2.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition());
            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);
        }
        public void TestBasics(ByteOrder byteOrder)
        {
            var ss  = CreateSerializationService(1, byteOrder);
            var ss2 = CreateSerializationService(2, byteOrder);

            var nn = new NamedPortable[5];

            for (var i = 0; i < nn.Length; i++)
            {
                nn[i] = new NamedPortable("named-portable-" + i, i);
            }

            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 main = new MainPortable(113, true, 'x', -500, 56789, -50992225L, 900.5678f, -897543.3678909d,
                                        "this is main portable object created for testing!", inner);

            var data = ss.ToData(main);

            Assert.AreEqual(main, ss.ToObject <MainPortable>(data));
            Assert.AreEqual(main, ss2.ToObject <MainPortable>(data));
        }
 public virtual void TestPreDefinedDifferentVersionsWithInnerPortable()
 {
     var serializationService = PortableSerializationTest.CreateSerializationService(1);
     serializationService.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition());
     var serializationService2 = PortableSerializationTest.CreateSerializationService(2);
     serializationService2.GetPortableContext().RegisterClassDefinition(CreateInnerPortableClassDefinition());
     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);
 }
 internal static void TestPreDefinedDifferentVersions(ISerializationService serializationService,
     ISerializationService serializationService2, MainPortable mainPortable)
 {
     var data = serializationService.ToData(mainPortable);
     Assert.AreEqual(mainPortable, serializationService2.ToObject<MainPortable>(data));
 }
 public virtual void TestPreDefinedDifferentVersionsWithNullInnerPortable()
 {
     var innerPortableClassDefinition = CreateInnerPortableClassDefinition();
     var serializationService = PortableSerializationTest.CreateSerializationService(1);
     serializationService.GetPortableContext().RegisterClassDefinition(innerPortableClassDefinition);
     var serializationService2 = PortableSerializationTest.CreateSerializationService(2);
     serializationService2.GetPortableContext().RegisterClassDefinition(innerPortableClassDefinition);
     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);
 }
 protected bool Equals(MainPortable other)
 {
     return b == other.b && Equals(bb, other.bb) && bo == other.bo && c == other.c && d.Equals(other.d) &&
            f.Equals(other.f) && i == other.i && l == other.l && s == other.s && string.Equals(str, other.str) &&
            Equals(p, other.p);
 }
        public void TestBasics(ByteOrder byteOrder)
        {
            var ss = CreateSerializationService(1, byteOrder);
            var ss2 = CreateSerializationService(2, byteOrder);

            var nn = new NamedPortable[5];
            for (var i = 0; i < nn.Length; i++)
            {
                nn[i] = new NamedPortable("named-portable-" + i, i);
            }

            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 main = new MainPortable(113, true, 'x', -500, 56789, -50992225L, 900.5678f, -897543.3678909d,
                "this is main portable object created for testing!", inner);

            var data = ss.ToData(main);

            Assert.AreEqual(main, ss.ToObject<MainPortable>(data));
            Assert.AreEqual(main, ss2.ToObject<MainPortable>(data));
        }
Ejemplo n.º 9
0
 protected bool Equals(MainPortable other)
 {
     return(b == other.b && Equals(bb, other.bb) && bo == other.bo && c == other.c && d.Equals(other.d) &&
            f.Equals(other.f) && i == other.i && l == other.l && s == other.s && string.Equals(str, other.str) &&
            Equals(p, other.p));
 }
Ejemplo n.º 10
0
        internal static void TestPreDefinedDifferentVersions(ISerializationService serializationService,
                                                             ISerializationService serializationService2, MainPortable mainPortable)
        {
            var data = serializationService.ToData(mainPortable);

            Assert.AreEqual(mainPortable, serializationService2.ToObject <MainPortable>(data));
        }