public void Post_ChangeStatus_WithValidDataShouldRedirectToAllRoutes() { //Arrange var controller = new RoutesController(this.routeService.Object, null, this.fixture.UserManagerMockInstance.Object, this.companyService.Object, null); this.routeService.Setup(r => r.IsRouteOwner(It.IsAny <int>(), It.IsAny <string>())) .Returns(true); this.companyService.Setup(c => c.IsApproved(It.IsAny <string>())) .Returns(true); this.companyService.Setup(c => c.IsBlocked(It.IsAny <string>())) .Returns(false); this.routeService.Setup(r => r.GetRouteBaseInfo(It.IsAny <int>(), It.IsAny <string>())) .Returns(this.GetRouteInfo()); this.routeService.Setup(r => r.HasReservedTickets(It.IsAny <int>(), It.IsAny <string>())) .Returns(false); this.routeService.Setup(r => r.ChangeStatus(It.IsAny <int>(), It.IsAny <string>())) .Returns(true); this.PrepareTempData(); controller.TempData = this.tempData.Object; //Act var result = controller.ChangeStatus(RouteId); //Assert this.AssertRedirectToCompanyRoutes(result); this.customMessage.Should().Be(string.Format(WebConstants.Message.RouteStatusChanged, StartStationName, EndStationName, DepartureTime, RouteStatus)); }
public void Post_ChangeStatus_WhenCompanyIsBlockedShouldRedirectToAllRoutes() { //Arrange var controller = new RoutesController(this.routeService.Object, null, this.fixture.UserManagerMockInstance.Object, this.companyService.Object, null); this.routeService.Setup(r => r.IsRouteOwner(It.IsAny <int>(), It.IsAny <string>())) .Returns(true); this.companyService.Setup(c => c.IsApproved(It.IsAny <string>())) .Returns(true); this.companyService.Setup(c => c.IsBlocked(It.IsAny <string>())) .Returns(true); this.PrepareTempData(); controller.TempData = this.tempData.Object; //Act var result = controller.ChangeStatus(RouteId); //Assert this.AssertRedirectToCompanyRoutes(result); this.customMessage.Should().Be(WebConstants.Message.ChangeRouteCompanyBlocked); }