public void WhenPostBodyCalledWithNullId_ReturnHome() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; var result = controller.Body(new ConfirmDeleteCompositeViewModel()) as RedirectResult; result.Should().NotBeNull(); result.Should().BeOfType <RedirectResult>(); result.Url.Should().Be($"~/home"); }
public async Task WhenShcDocumentsReturnEmpty_ReturnHomeHtml() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; _skillsHealthCheckService.GetShcDocumentsForUser(Arg.Any <string>()).Returns(new List <ShcDocument>()); var result = await controller.Body("123345") as RedirectResult; result.Should().NotBeNull(); result.Should().BeOfType <RedirectResult>(); result.Url.Should().Be("~/home"); }
public async Task WhenBodyCalledWithoutId_ReturnHomeHtml() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; var result = await controller.Body("") as RedirectResult; result.Should().NotBeNull(); result.Should().BeOfType <RedirectResult>(); result.Url.Should().Be("~/home"); }
public async Task WhenDefaultBodyCalled_ReturnHtml() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; var result = await controller.Body() as ViewResult; result.Should().NotBeNull(); result.Should().BeOfType <ViewResult>(); result.ViewName.Should().BeNull(); }
public void WhenPostBodyCalled_ReturnHtml() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; var id = "12345"; var result = controller.Body(new ConfirmDeleteCompositeViewModel { DocumentId = id }) as RedirectResult; result.Should().NotBeNull(); result.Should().BeOfType <RedirectResult>(); result.Url.Should().Be($"~/shc-deleted?id={id}"); }
public async Task WhenBodyCalled_ReturnHtml() { var controller = new ConfirmDeleteController(_compositeSettings, _authService, _skillsHealthCheckService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; _skillsHealthCheckService.GetShcDocumentsForUser(Arg.Any <string>()).Returns(new List <ShcDocument> { new ShcDocument { CreatedAt = DateTimeOffset.UtcNow, LinkUrl = "url", DocumentId = "200010216" } }); var result = await controller.Body("200010216") as ViewResult; result.Should().NotBeNull(); result.Should().BeOfType <ViewResult>(); result.ViewName.Should().BeNull(); }