Пример #1
0
        public void ShouldSerializeSimpleType()
        {
            var obj = new SimpleType
            {
                DateTime = DateTime.UtcNow,
                Flag     = true,
                Name     = "Name",
                Value    = 456,
                Inner    = new SimpleType.InnerClass()
                {
                    InnerValue = "Inner"
                }
            };

            var serializer = new MongoTransitionDataSerializer();
            var doc        = serializer.Serialize(obj);

            var back = (SimpleType)serializer.Deserialize(doc, typeof(SimpleType));

            Assert.AreEqual(obj.Name, back.Name);
            Assert.AreEqual(obj.Flag, back.Flag);
            Assert.AreEqual(obj.Inner.InnerValue, back.Inner.InnerValue);
            Assert.AreEqual(obj.DateTime, back.DateTime);
        }
        public void ShouldSerializeSimpleType()
        {
            var obj = new SimpleType
            {
                DateTime = DateTime.UtcNow,
                Flag = true,
                Name = "Name",
                Value = 456,
                Inner = new SimpleType.InnerClass()
                {
                    InnerValue = "Inner"
                }
            };

            var serializer = new MongoTransitionDataSerializer();
            var doc = serializer.Serialize(obj);

            var back = (SimpleType) serializer.Deserialize(doc, typeof(SimpleType));

            Assert.AreEqual(obj.Name, back.Name);
            Assert.AreEqual(obj.Flag, back.Flag);
            Assert.AreEqual(obj.Inner.InnerValue, back.Inner.InnerValue);
            Assert.AreEqual(obj.DateTime, back.DateTime);
        }