public async Task DetailTestNotFound() { //Arange var controller = new ContractenController(_calculationsService, _unitOfWork.Object, _contractRepository.Object); //Act var result = await controller.Details(null); //Assert var contentResult = Assert.IsType <NotFoundResult>(result); }
public async Task Detail_ReturnsAViewResult_WithAContractDTO() { //Arrange var contractID = 1; ContractDTO contract = (GetContracts().FirstOrDefault(m => m.ContractID == contractID)); var medewerkers = GetMedewerkers(); var medewerkerDTO = new MedewerkerDTO(medewerkers[1]); contract.medewerker = medewerkerDTO; _contractRepository.Setup(repo => repo.GetByIdAsync(contractID)).Returns(Task.FromResult(contract)); var controller = new ContractenController(_calculationsService, _unitOfWork.Object, _contractRepository.Object); //Act var result = await controller.Details(contractID); //Assert var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsType <ContractDTO>( viewResult.ViewData.Model); Assert.Equal(1, model.ContractID); }