Exemplo n.º 1
0
        public void DeleteById_ValidObjectId_ShouldBeDeletedAndReturnTrue()
        {
            _gigRepository.Add(_testGigOne);
            _gigRepository.Add(_testGigTwo);

            var countBefore = _mongoDatabaseUtilities.CountRecordsInCollection();

            // Perform
            var result = _gigRepository.DeleteById(_testGigOne.Id);

            // Verify
            Assert.IsTrue(result);
            var countAfter = _mongoDatabaseUtilities.CountRecordsInCollection();

            Assert.AreEqual(countBefore - 1, countAfter);

            var findResult = _mongoDatabaseUtilities.FindRecordById(_testGigOne.Id);

            CollectionAssert.IsEmpty(findResult);
        }