Exemplo n.º 1
0
        public void TestContext()
        {
            var contextClass = new ContextClass();
            var serializer = new BinarySerialization.BinarySerializer();

            var context = new Context {SerializeCondtion = false};

            var stream = new MemoryStream();
            serializer.Serialize(stream, contextClass, context);

            context = new Context { SerializeCondtion = true };

            stream = new MemoryStream();
            serializer.Serialize(stream, contextClass, context);

            Assert.AreEqual(sizeof(int), stream.Length);
        }
Exemplo n.º 2
0
        public void ContextTest()
        {
            var contextClass = new ContextClass();
            var serializer   = new BinarySerializer();

            var context = new Context {
                SerializeCondtion = false
            };

            var stream = new MemoryStream();

            serializer.Serialize(stream, contextClass, context);

            context = new Context {
                SerializeCondtion = true
            };

            stream = new MemoryStream();
            serializer.Serialize(stream, contextClass, context);

            Assert.Equal(sizeof(int), stream.Length);
        }