예제 #1
0
        public static void Delete_Should_Works()
        {
            // arrange
            var mongoClient = FakeMongoClient.GetMongoClientMock <GenericTestWithIdProperty>(true).Object;
            var mongoCRUD   = new MongoCRUD <GenericTestWithIdProperty>(mongoClient, "SomeDB");
            var id          = "123";

            // act
            var isAcknowledged = mongoCRUD.Delete(id);

            // assert
            Assert.True(isAcknowledged);
        }
예제 #2
0
        public static void Delete_Should_Throws_Exception_When_Id_Is_Null()
        {
            // arrange
            var    mongoClient = FakeMongoClient.GetMongoClientMock <GenericTestWithIdProperty>(true).Object;
            var    mongoCRUD   = new MongoCRUD <GenericTestWithIdProperty>(mongoClient, "SomeDB");
            string id          = null;

            // act
            Exception ex =
                Assert.Throws <ArgumentNullException>(() => mongoCRUD.Delete(id));

            // assert
            Assert.Equal("Value cannot be null.\r\nParameter name: id", ex.Message);
        }