Exemple #1
0
        public void ReplaceElements_NullOrEmptyTargetSelector_ThrowsArgumentNullException(
            [Values(null, "")] string selector)
        {
            Action action = () => Taconite.Replace(selector);

            action.ShouldThrow <ArgumentNullException>();
        }
Exemple #2
0
        public void ReplaceElementsWithPartialViewResultContent_NullPartialViewResult_ThrowsArgumentNullException()
        {
            var selector = "#selector";

            Action action = () => Taconite.Replace(selector).WithContent((PartialViewResult)null);

            action.ShouldThrow <ArgumentNullException>();
        }
Exemple #3
0
        public void ReplaceElementsWithRawHtmlContent_NullHtmlContent_ThrowsArgumentNullException()
        {
            var selector = "#selector";

            Action action = () => Taconite.Replace(selector).WithContent((string)null);

            action.ShouldThrow <ArgumentNullException>();
        }
Exemple #4
0
        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();
        }
Exemple #5
0
        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
            });
        }
Exemple #6
0
        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
            });
        }
Exemple #7
0
 public TaconiteResult Replace()
 {
     return(Taconite.Replace("#replaceTarget .example-block").WithPartialView("GreenBox"));
 }