public void TestGetEditStation() { // Arrange var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub())); var RouteID = 1; var StationID = 1; // ACt var result = (ViewResult)controller.EditStation(RouteID, StationID); // Assert Assert.AreEqual("", result.ViewName); }
public void TestPostEditStationDBError() { // Arrange var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub())); var OneStation = new Station { StationID = 0, StationName = null }; var RouteID = 1; // ACt var result = (ViewResult)controller.EditStation(RouteID, OneStation); // Assert Assert.AreEqual("", result.ViewName); }
public void TestPostEditStationValidationError() { // Arrange var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub())); controller.ViewData.ModelState.AddModelError("StationName", "Station name should string!"); var OneStation = new Station(); var RouteID = 1; // ACt var result = (ViewResult)controller.EditStation(RouteID, OneStation); // Assert Assert.AreEqual("", result.ViewName); }
public void TestPostEditStation() { // Arrange var controller = new RoutesController(new RouteLogic(new RouteRepositoryStub()), new StationLogic(new StationRepositoryStub())); var OneStation = new Station { StationID = 1, StationName = "Bergen", StationNumber = 2 }; var RouteID = 1; // ACt var result = (RedirectToRouteResult)controller.EditStation(RouteID, OneStation); // Assert Assert.AreEqual("", result.RouteName); Assert.AreEqual(RouteID, result.RouteValues["RouteID"]); Assert.AreEqual("Details", result.RouteValues["action"]); }