public void ReplaceElements_NullOrEmptyTargetSelector_ThrowsArgumentNullException( [Values(null, "")] string selector) { Action action = () => Taconite.Replace(selector); action.ShouldThrow <ArgumentNullException>(); }
public void ReplaceElementsWithPartialViewResultContent_NullPartialViewResult_ThrowsArgumentNullException() { var selector = "#selector"; Action action = () => Taconite.Replace(selector).WithContent((PartialViewResult)null); action.ShouldThrow <ArgumentNullException>(); }
public void ReplaceElementsWithRawHtmlContent_NullHtmlContent_ThrowsArgumentNullException() { var selector = "#selector"; Action action = () => Taconite.Replace(selector).WithContent((string)null); action.ShouldThrow <ArgumentNullException>(); }
public void ReplaceElementsWithPartialView_ViewNameAndModelNotSpecified() { var selector = "#selector"; var result = Taconite.Replace(selector).WithPartialView(); result.Commands.Should().HaveCount(1); var command = result.Commands.Single(); command.As <ElementCommand>() .Should().NotBeNull() .ShouldHave().SharedProperties().EqualTo(new { Command = "replace", Html = (string)null, Selector = selector }); command.As <ElementCommand>().Partial.Model.Should().BeNull(); command.As <ElementCommand>().Partial.View.Should().BeNull(); }
public void ReplaceElementsWithPartialViewResultContent() { var partialViewResult = new PartialViewResult(); var selector = "#selector"; var result = Taconite.Replace(selector).WithContent(partialViewResult); result.Commands.Should().HaveCount(1); var command = result.Commands.Single(); command.As <ElementCommand>() .Should().NotBeNull() .ShouldHave().SharedProperties().EqualTo(new { Command = "replace", Html = (string)null, Partial = partialViewResult, Selector = selector }); }
public void ReplaceElementsWithRawHtmlContent() { var selector = "#selector"; var html = "<div>Some HTML!</div>"; var result = Taconite.Replace(selector).WithContent(html); result.Commands.Should().HaveCount(1); var command = result.Commands.Single(); command.As <ElementCommand>() .Should().NotBeNull() .ShouldHave().SharedProperties().EqualTo(new { Command = "replace", Html = html, PartialViewResult = (PartialViewResult)null, Selector = selector }); }
public TaconiteResult Replace() { return(Taconite.Replace("#replaceTarget .example-block").WithPartialView("GreenBox")); }