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"); }
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(); }
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); }
public void AddInline(string scriptContent, string pageLocation = null) { Bundles.AddInlineScript(scriptContent, pageLocation); }