コード例 #1
0
        public void DeleteRegistrated_WhenCalled_ReturnsNotFound(int id)
        {
            // Arrange
            service.Setup(x => x.Delete(id))
            .Returns(false);

            mapper.Setup(x => x.Map <WorkerServiceModel>(It.IsAny <WorkerControllerModel>()))
            .Returns(userService);

            // Act
            var result = usersController.DeleteWorker(id);

            // Assert
            var response = result as StatusCodeResult;

            Assert.Equal(404, response.StatusCode);
        }
コード例 #2
0
        public void DeleteRegistrated_WhenCalled__ReturnsInternalError(int id)
        {
            // Arrange
            usersController = new WorkersController(null, null, log.Object);

            // Act
            var result = usersController.DeleteWorker(id);

            Assert.IsType <StatusCodeResult>(result);

            // Assert
            var response = result as StatusCodeResult;

            Assert.Equal(500, response.StatusCode);
        }