示例#1
0
        public void AddInlineScriptWithLambdaAddsReferenceToInlineScriptBundle()
        {
            Bundle bundle = null;

            referenceBuilder.Setup(b => b.Reference(It.IsAny <Bundle>(), "location"))
            .Callback <Bundle, string>((b, s) => bundle = b);

            Bundles.AddInlineScript(_ => "content", "location");

            bundle.ShouldBeType <InlineScriptBundle>();
            bundle.Render().ShouldContain("content");
        }
示例#2
0
        public void AddInlineWithLambdaAndNoLocationCreatesBundleWithPageLocationNull()
        {
            Bundle bundle = null;

            referenceBuilder.Setup(b => b.Reference(It.IsAny <Bundle>(), null))
            .Callback <Bundle, string>((b, s) => bundle = b);

            Bundles.AddInlineScript(_ => "content");

            bundle.ShouldBeType <InlineScriptBundle>();
            bundle.Render().ShouldContain("content");
            bundle.PageLocation.ShouldBeNull();
        }
示例#3
0
        public void AddInlineScriptWithCustomizeAction_ThenCustomizeActionCalledWithTheBundle()
        {
            Bundle bundle                = null;
            Bundle customizedBundle      = null;
            Action <ScriptBundle> action = b => customizedBundle = b;

            referenceBuilder.Setup(b => b.Reference(It.IsAny <Bundle>(), "location"))
            .Callback <Bundle, string>((b, s) => bundle = b);

            Bundles.AddInlineScript("content", "location", action);

            customizedBundle.ShouldNotBeNull().ShouldBeSameAs(bundle);
        }
示例#4
0
 public void AddInline(string scriptContent, string pageLocation = null)
 {
     Bundles.AddInlineScript(scriptContent, pageLocation);
 }