Esempio n. 1
0
        public void EditDocument_UpdatingExsistingDocument()
        {
            // arrange
            var id       = "123";
            var document = new Person
            {
                Name = "updated name",
                Age  = 50
            }.ToBsonDocument();
            var collection  = new MockMongoCollection <BsonDocument>();
            var oldDocument = _provider.GetDocumentById(id, collection);

            // act
            _provider.EditDocument(id, document, collection);

            Assert.AreEqual(oldDocument["_id"].AsString, document["_id"].AsString);
            Assert.AreNotEqual(oldDocument["name"].AsString, document["name"].AsString);
        }