public async Task Details_ReturnsANotFound() { //Arrange var controller = new DienstController(_unitOfWork.Object, _dienstRepository.Object); //Act var result = await controller.Details(null); //Assert var contentResult = Assert.IsType <NotFoundResult>(result); }
public async Task Detail_ReturnsAViewResult_WithADienstDTO() { //Arrange int dienstID = 1; DienstDTO dienst = (GetDiensten().FirstOrDefault(c => c.DienstID == dienstID)); _dienstRepository.Setup(repo => repo.GetByIdAsync(dienstID)).Returns(Task.FromResult(dienst)); var controller = new DienstController(_unitOfWork.Object, _dienstRepository.Object); //Act var result = await controller.Details(dienstID); //Assert var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsType <DienstDTO>( viewResult.ViewData.Model); Assert.Equal(1, model.DienstID); }