Пример #1
0
        public async Task TestDeserializationWithIBBoolFalse()
        {
            var stream = new MemoryStream();
            var fieldsStream = new FieldsStream(stream);
            var message = new MessageWithIBBool {Field = false};

            await this.serializer.Write(message, fieldsStream, CancellationToken.None);

            stream.Seek(0, SeekOrigin.Begin);
            var result = await this.serializer.ReadClientMessage(fieldsStream, CancellationToken.None);

            Assert.AreEqual(message, result);
        }
Пример #2
0
 private bool Equals(MessageWithIBBool other)
 {
     return this.Field.Equals(other.Field);
 }
Пример #3
0
        public void TestSerializationWithIBBoolFalse()
        {
            var stream = new MemoryStream();
            var fieldsStream = new FieldsStream(stream);
            var message = new MessageWithIBBool {Field = false};

            this.serializer.Write(message, fieldsStream, CancellationToken.None);

            var result = new byte[7];
            stream.Seek(0, SeekOrigin.Begin);
            stream.Read(result, 0, result.Length);

            Assert.AreEqual(result.Length, stream.Length);

            var expected = Encoding.ASCII.GetBytes(
                1008.ToString() + char.MinValue +
                "0" + char.MinValue);

            Assert.IsTrue(expected.SequenceEqual(result));
        }