public void WhenCreatingClassWithListOfInterfaceShouldHaveAllImplements() { var mapper = new BsonMapper(); List <MyInterface> interfaces = new List <MyInterface>() { new Impl1(), new Impl2(), new ImplWithProperty() { name = RANDOM_NAME } }; ClassWithListInterface obj = new ClassWithListInterface() { interfaces = interfaces }; ClassWithListInterface mappedObject = MapAndDemapObject(mapper, obj); Assert.AreEqual(obj.interfaces[0].getName(), mappedObject.interfaces[0].getName()); Assert.AreEqual(obj.interfaces[1].getName(), mappedObject.interfaces[1].getName()); Assert.AreEqual(obj.interfaces[2].getName(), mappedObject.interfaces[2].getName()); }
private ClassWithListInterface MapAndDemapObject(BsonMapper mapper, ClassWithListInterface obj) { return(mapper.ToObject <ClassWithListInterface>(mapper.ToDocument(obj))); }