public void FeedbackThankYouShouldNotRedirectToStartWhenReturnUrlIsConfirmation(string urlReferer) { //arrange var fakeConfiguration = new ConfigurationBuilder() .Add(configData) .Build(); var requestMock = new Mock <HttpRequest>(); var contextMock = new Mock <HttpContext>(); contextMock.SetupGet(x => x.Request).Returns(requestMock.Object); //Controller needs a controller context var controllerContext = new ControllerContext() { HttpContext = contextMock.Object//httpContext, }; var mockLogger = new Mock <ILogger <HelpController> >(); var mockFormService = new Mock <IFormService>(); var mockGdsValidation = new Mock <IGdsValidation>(); var mockNotificationService = new Mock <INotificationService>(); var mockSessionService = new Mock <ISessionService>(); var mockActionService = new Mock <IActionService>(); //act var sut = new HelpController(mockLogger.Object, mockFormService.Object, mockGdsValidation.Object, fakeConfiguration, mockNotificationService.Object, mockSessionService.Object, mockActionService.Object); sut.ControllerContext = controllerContext; var response = sut.FeedbackThankYou(urlReferer); //assert var result = response as ViewResult; var redirectVm = result?.Model as RedirectVM; redirectVm.Url.Should().Be(urlReferer); }