public void ReportaProblemShouldReturn555StatusCode() { //arrange var fakeConfiguration = new ConfigurationBuilder() .Add(configData) .Build(); //Controller needs a controller context var httpContext = new DefaultHttpContext(); var controllerContext = new ControllerContext() { HttpContext = httpContext, }; var formVm = new FormVM { Pages = new List <PageVM>() }; var mockLogger = new Mock <ILogger <HelpController> >(); var mockFormService = new Mock <IFormService>(); mockFormService.Setup(x => x.FindByNameAndVersion("form1", "version1")).ReturnsAsync(formVm); 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.Feedback("urlReferer"); //assert var result = response as StatusResult; result.StatusCode.Should().Be(555); }
public void ReportaProblemShouldReturn555StatusCode() { //arrange //Controller needs a controller context var httpContext = new DefaultHttpContext(); var controllerContext = new ControllerContext() { HttpContext = httpContext, }; var mockService = new Mock <IServiceProvider>(); //act var sut = new HelpController(mockService.Object); sut.ControllerContext = controllerContext; var response = sut.Feedback("urlReferer"); //assert var result = response as StatusResult; result.StatusCode.Should().Be(555); }