Esempio n. 1
0
        public void Delete_NotFound()
        {
            var controller = new ToggleController(_repositoryMock.Object);

            var result       = controller.Delete(new Guid());
            var objectResult = result as NotFoundResult;

            Assert.IsNotNull(objectResult);
            Assert.AreEqual((int)HttpStatusCode.NotFound, objectResult.StatusCode);
        }
Esempio n. 2
0
        public void Delete_Successful()
        {
            var id = new Guid();

            _repositoryMock.Setup(rep => rep.Contains(id)).Returns(true);
            var controller = new ToggleController(_repositoryMock.Object);

            var result       = controller.Delete(id);
            var actionResult = result as NoContentResult;

            Assert.IsNotNull(actionResult);
            _repositoryMock.Verify(rep => rep.Remove(id), Times.Once);
            _repositoryMock.Verify(rep => rep.Save(), Times.Once);
            Assert.AreEqual((int)HttpStatusCode.NoContent, actionResult.StatusCode);
        }