示例#1
0
 protected bool Equals(InnerPortable other)
 {
     return(bb.SequenceEqual(other.bb) && cc.SequenceEqual(other.cc) && dd.SequenceEqual(other.dd) &&
            ff.SequenceEqual(other.ff) &&
            ii.SequenceEqual(other.ii) && ll.SequenceEqual(other.ll) && nn.SequenceEqual(other.nn) &&
            ss.SequenceEqual(other.ss));
 }
示例#2
0
 public void ReadPortable(IPortableReader reader)
 {
     b   = reader.ReadByte("b");
     bo  = reader.ReadBoolean("bool");
     c   = reader.ReadChar("c");
     s   = reader.ReadShort("s");
     i   = reader.ReadInt("i");
     l   = reader.ReadLong("l");
     f   = reader.ReadFloat("f");
     d   = reader.ReadDouble("d");
     str = reader.ReadUTF("str");
     p   = reader.ReadPortable <InnerPortable>("p");
 }
 internal MainPortable(byte b, bool bo, char c, short s, int i, long l, float f, double d, string str,
     InnerPortable p)
 {
     this.b = b;
     this.bo = bo;
     this.c = c;
     this.s = s;
     this.i = i;
     this.l = l;
     this.f = f;
     this.d = d;
     this.str = str;
     this.p = p;
 }
示例#4
0
 internal MainPortable(byte b, bool bo, char c, short s, int i, long l, float f, double d, string str,
                       InnerPortable p)
 {
     this.b   = b;
     this.bo  = bo;
     this.c   = c;
     this.s   = s;
     this.i   = i;
     this.l   = l;
     this.f   = f;
     this.d   = d;
     this.str = str;
     this.p   = p;
 }
示例#5
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);
 }
 public void ReadPortable(IPortableReader reader)
 {
     b = reader.ReadByte("b");
     bo = reader.ReadBoolean("bool");
     c = reader.ReadChar("c");
     s = reader.ReadShort("s");
     i = reader.ReadInt("i");
     l = reader.ReadLong("l");
     f = reader.ReadFloat("f");
     d = reader.ReadDouble("d");
     str = reader.ReadUTF("str");
     p = reader.ReadPortable<InnerPortable>("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));
        }
 protected bool Equals(InnerPortable other)
 {
     return Enumerable.SequenceEqual(bb, other.bb) && Enumerable.SequenceEqual(cc, other.cc) && Enumerable.SequenceEqual(dd, other.dd) && Enumerable.SequenceEqual(ff, other.ff) &&
            Enumerable.SequenceEqual(ii, other.ii) && Enumerable.SequenceEqual(ll, other.ll) && Enumerable.SequenceEqual(nn, other.nn) && Enumerable.SequenceEqual(ss, other.ss);
 }
示例#11
0
 protected bool Equals(InnerPortable other)
 {
     return(Enumerable.SequenceEqual(bb, other.bb) && Enumerable.SequenceEqual(cc, other.cc) && Enumerable.SequenceEqual(dd, other.dd) && Enumerable.SequenceEqual(ff, other.ff) &&
            Enumerable.SequenceEqual(ii, other.ii) && Enumerable.SequenceEqual(ll, other.ll) && Enumerable.SequenceEqual(nn, other.nn) && Enumerable.SequenceEqual(ss, other.ss));
 }
 protected bool Equals(InnerPortable other)
 {
     return bb.SequenceEqual(other.bb) && cc.SequenceEqual(other.cc) && dd.SequenceEqual(other.dd) &&
            ff.SequenceEqual(other.ff) &&
            ii.SequenceEqual(other.ii) && ll.SequenceEqual(other.ll) && nn.SequenceEqual(other.nn) &&
            ss.SequenceEqual(other.ss);
 }