示例#1
0
        public void SerializationOfInheritenceIsNotLossy_EvenWhenWeAskForTheBaseType()
        {
            var obj1 = new SubClassedObject {
                Title = "The Title", ABool = true
            };
            var hydratedObj1 = (SubClassedObject)BsonDeserializer.Deserialize <SuperClassObject>(BsonSerializer.Serialize(obj1));

            Assert.Equal(obj1.Title, hydratedObj1.Title);
            Assert.Equal(obj1.ABool, hydratedObj1.ABool);
        }
示例#2
0
        public void SerializationOfInheritenceIsNotLossy()
        {
            var obj1 = new SubClassedObject {
                Title = "Subclassed", ABool = true
            };
            var hydratedObj1 = BsonDeserializer.Deserialize <SubClassedObject>(BsonSerializer.Serialize(obj1));

            Assert.Equal(obj1.Title, hydratedObj1.Title);
            Assert.Equal(obj1.ABool, hydratedObj1.ABool);
        }