public void ProcessResult_WhenRequestedWithModelUsingPartial_ReturnsCombinedView() { var response = new FakeResponseContext(); var model = new UserModel { ID = 42, Username = "******" }; var result = new RazorResult<UserModel>(model, "../../Test Data/Views/Razor/View.cshtml"); Assert.That(result.ViewPath, Is.EqualTo("../../Test Data/Views/Razor/View.cshtml")); Assert.That(result.Model.ID, Is.EqualTo(42)); Assert.That(result.Model.Username, Is.EqualTo("Username")); result.ProcessResult(null, response); Assert.That(response.ContentType, Is.EqualTo("text/html")); Assert.That(response.Response, Contains.Substring("<span>partial</span>")); }
public void ProcessResult_WhenRequestedWithModel_ReturnsViewData() { var response = new FakeResponseContext(); var model = new UserModel { ID = 42, Username = "******" }; var result = new SparkResult<UserModel>(model, "../../Test Data/Views/Spark/View.spark"); Assert.That(result.ViewPath, Is.EqualTo("../../Test Data/Views/Spark/View.spark")); Assert.That(result.Model.ID, Is.EqualTo(42)); Assert.That(result.Model.Username, Is.EqualTo("Username")); result.ProcessResult(null, response); Assert.That(response.ContentType, Is.EqualTo("text/html")); Assert.That(response.Response, Contains.Substring("<h1>42</h1>")); Assert.That(response.Response, Contains.Substring("<h2>Username</h2>")); }