コード例 #1
0
        public void DeletePersonReturnsNotFoundWhenPersonIsNotFound()
        {
            Person person = null;

            _personRepositoryMock.Setup(m => m.GetById(It.IsAny <int>()))
            .Returns(person);

            var result = _sut.DeleteEntity(1) as NotFoundObjectResult;

            Assert.That(result, Is.Not.Null);

            _personRepositoryMock.Verify(m => m.GetById(It.IsAny <int>()), Times.Once);
            _personRepositoryMock.Verify(m => m.Remove(It.IsAny <Person>()), Times.Never);
        }