public async Task CreateVisitStep2_Returns_View_When_ModelStateInvalid() { _appService.Setup(m => m.GetDoctorsAppointmentsForDay(It.IsAny <string>(), It.IsAny <DateTime>(), CancellationToken.None)) .ReturnsAsync(It.IsAny <DoctorsViewModel>()); var sut = new PatientsController(_appService.Object) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal( new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "tesuser") }, "testAuthType")) } } }; sut.ModelState.AddModelError("test", "test"); var result = await sut.CreateVisitStep2(new CreateVisitViewModel()); result.Should().BeOfType <ViewResult>(); sut.Dispose(); }
public async Task Index_Return_View() { var sut = new PatientsController(_appService.Object) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal( new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "tesuser") }, "testAuthType")) } } }; var result = await sut.Index(); result.Should().BeOfType <ViewResult>(); sut.Dispose(); }
public async Task SubmitChangedInfo_Redirects_To_IndexAction() { _appService.Setup(m => m.ChangePatientInfo(It.IsAny <string>(), CancellationToken.None)) .ReturnsAsync(It.IsAny <ChangePatientInfoViewModel>()); var sut = new PatientsController(_appService.Object) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = new ClaimsPrincipal( new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "tesuser") }, "testAuthType")) } } }; var result = await sut.SubmitChangedInfo(new ChangePatientInfoViewModel(), CancellationToken.None); result.Should().BeOfType <RedirectToActionResult>(); sut.Dispose(); }