Пример #1
0
        public void ExecutePlugin_NullOrEmptyPluginName_ThrowsArgumentNullException(
            [Values(null, "")] string pluginName)
        {
            Action action = () => Taconite.ExecutePlugin(pluginName);

            action.ShouldThrow <ArgumentNullException>();
        }
Пример #2
0
        public void ExecutePluginWithPartialViewResult_NullPartialViewResult_ThrowsArgumentNullException()
        {
            var plugin   = "plugin";
            var selector = "#selector";

            Action action = () => Taconite.ExecutePlugin(plugin).For(selector).WithContent((PartialViewResult)null);

            action.ShouldThrow <ArgumentNullException>();
        }
Пример #3
0
        public void ExecutePlugin_NullOrEmptyTargetSelector_ThrowsArgumentNullException(
            [Values(null, "")] string selector)
        {
            var plugin = "plugin";

            Action action = () => Taconite.ExecutePlugin(plugin).For(selector);

            action.ShouldThrow <ArgumentNullException>();
        }
Пример #4
0
        public void ExecutePluginWithRawHtmlContent_NullHtmlContent_ThrowsArgumentNullException()
        {
            var plugin   = "plugin";
            var selector = "#selector";

            Action action = () => Taconite.ExecutePlugin(plugin).For(selector).WithContent((string)null);

            action.ShouldThrow <ArgumentNullException>();
        }
Пример #5
0
        public void ExecutePluginWithNoArguments()
        {
            var plugin   = "plugin";
            var selector = "#selector";

            var result = Taconite.ExecutePlugin(plugin).For(selector).WithNoArguments();

            result.Commands.Should().HaveCount(1);
            var command = result.Commands.Single();

            command.As <NonElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command  = plugin,
                Selector = selector,
            });
            command.As <NonElementCommand>().Arguments.Should().BeEmpty();
        }
Пример #6
0
        public void ExecutePluginWithPartialView_ViewNameAndModelNotSpecified()
        {
            var plugin   = "plugin";
            var selector = "#selector";

            var result = Taconite.ExecutePlugin(plugin).For(selector).WithPartialView();

            result.Commands.Should().HaveCount(1);
            var command = result.Commands.Single();

            command.As <ElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command  = plugin,
                Html     = (string)null,
                Selector = selector
            });
            command.As <ElementCommand>().Partial.Model.Should().BeNull();
            command.As <ElementCommand>().Partial.View.Should().BeNull();
        }
Пример #7
0
        public void ExecutePluginWithPartialViewResultContent()
        {
            var plugin            = "plugin";
            var selector          = "#selector";
            var partialViewResult = new PartialViewResult();

            var result = Taconite.ExecutePlugin(plugin).For(selector).WithContent(partialViewResult);

            result.Commands.Should().HaveCount(1);
            var command = result.Commands.Single();

            command.As <ElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command           = plugin,
                Html              = (string)null,
                Selector          = selector,
                PartialViewResult = partialViewResult
            });
        }
Пример #8
0
        public void ExecutePluginWithRawHtmlContent()
        {
            var plugin   = "plugin";
            var selector = "#selector";
            var html     = "<div>Some HTML!</div>";

            var result = Taconite.ExecutePlugin(plugin).For(selector).WithContent(html);

            result.Commands.Should().HaveCount(1);
            var command = result.Commands.Single();

            command.As <ElementCommand>()
            .Should().NotBeNull()
            .ShouldHave().SharedProperties().EqualTo(new
            {
                Command           = plugin,
                Html              = html,
                Selector          = selector,
                PartialViewResult = (PartialViewResult)null
            });
        }
Пример #9
0
 public TaconiteResult ExecutePlugin()
 {
     return(Taconite.ExecutePlugin("modal").For("#executePluginModal").WithNoArguments());
 }