public void TestClone() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.AreEqual(false, wrapper.IsMaterialized); var clonedWrapper = (BsonDocumentWrapper)wrapper.Clone(); Assert.AreEqual(false, wrapper.IsMaterialized); Assert.AreEqual(false, clonedWrapper.IsMaterialized); Assert.AreSame(wrapper.WrappedNominalType, clonedWrapper.WrappedNominalType); Assert.AreSame(wrapper.WrappedObject, clonedWrapper.WrappedObject); Assert.AreSame(wrapper.Serializer, clonedWrapper.Serializer); Assert.AreSame(wrapper.SerializationOptions, clonedWrapper.SerializationOptions); Assert.AreEqual(wrapper.IsUpdateDocument, clonedWrapper.IsUpdateDocument); Assert.AreEqual(wrapper, clonedWrapper); Assert.AreEqual(true, wrapper.IsMaterialized); Assert.AreEqual(true, clonedWrapper.IsMaterialized); wrapper = new BsonDocumentWrapper(new BsonDocument()); wrapper["x"] = 1; Assert.AreEqual(true, wrapper.IsMaterialized); var clonedDocument = wrapper.Clone(); Assert.IsInstanceOf <BsonDocument>(clonedDocument); Assert.AreEqual(wrapper, clonedDocument); }
public void TestClone() { var wrapper = new BsonDocumentWrapper(new BsonDocument("x", 1)); Assert.Equal(false, wrapper.IsMaterialized); var clonedWrapper = (BsonDocumentWrapper)wrapper.Clone(); Assert.Equal(false, wrapper.IsMaterialized); Assert.Equal(false, clonedWrapper.IsMaterialized); Assert.Same(wrapper.Wrapped, clonedWrapper.Wrapped); Assert.Same(wrapper.Serializer, clonedWrapper.Serializer); Assert.Equal(wrapper, clonedWrapper); Assert.Equal(true, wrapper.IsMaterialized); Assert.Equal(true, clonedWrapper.IsMaterialized); wrapper = new BsonDocumentWrapper(new BsonDocument()); wrapper["x"] = 1; Assert.Equal(true, wrapper.IsMaterialized); var clonedDocument = wrapper.Clone(); Assert.IsType <BsonDocument>(clonedDocument); Assert.StrictEqual(wrapper, clonedDocument); }