public void Step3_Should_Redirect_When_Installed_Is_True() { // Arrange _applicationSettings.Installed = true; // Act ActionResult result = _installController.Step3(new SettingsViewModel()); // Assert RedirectToRouteResult redirectResult = result.AssertResultIs <RedirectToRouteResult>(); redirectResult.AssertActionRouteIs("Index"); redirectResult.AssertControllerRouteIs("Home"); }
public void step3_should_return_viewresult_with_settingsviewmodel() { // Arrange SettingsViewModel existingModel = new SettingsViewModel(); existingModel.ConnectionString = "connectionstring"; existingModel.SiteUrl = "siteurl"; existingModel.SiteName = "sitename"; // Act ActionResult result = _installController.Step3(existingModel); // Assert ViewResult viewResult = result.AssertResultIs <ViewResult>(); viewResult.AssertViewRendered(); SettingsViewModel model = viewResult.ModelFromActionResult <SettingsViewModel>(); Assert.NotNull(model, "Null model"); /* The view is responsible for passing these across, * but this gives a rough indication that no data is lost between steps */ Assert.That(model.ConnectionString, Is.EqualTo(existingModel.ConnectionString)); Assert.That(model.SiteUrl, Is.EqualTo(existingModel.SiteUrl)); Assert.That(model.SiteName, Is.EqualTo(existingModel.SiteName)); }