Exemple #1
0
        public void ReadObject1DArrayTest()
        {
            List <InnerClass> values = new List <InnerClass>()
            {
                new InnerClass()
                {
                    m_bool = true, m_double = 0.1, m_float = 150
                },
                new InnerClass()
                {
                    m_bool = false, m_double = 2.1, m_float = 150e5F
                },
            };

            SerializedStreamBuilder builder = new SerializedStreamBuilder()
                                              .Size((byte)2);

            foreach (InnerClass innerClass in values)
            {
                builder
                .Float(innerClass.m_float)
                .Double(innerClass.m_double)
                .Boolean(innerClass.m_bool);
            }

            BinaryReader reader = new BinaryReader(builder.ToStream(), DeserializationHelper.CannedVersion);

            List <InnerClass> actual = (List <InnerClass>)reader.ReadObjectArray <InnerClass>(string.Empty, false, 1);

            Assert.IsNotNull(actual);

            TestHelper.AssertCollectionEquals <InnerClass>(values, actual);
        }
Exemple #2
0
        public void VersionTest()
        {
            SchemaVersion expected = TestHelper.GetEexpectedVersion();

            SerializedStreamBuilder builder = new SerializedStreamBuilder();

            BinaryReader reader = new BinaryReader(builder.ToStream(), expected);

            Assert.AreEqual <short>(expected.getVersionNumber(), reader.Version.getVersionNumber());
        }