public ExternalStylesheetHtmlRenderer_Tests() { settings = new CassetteSettings(""); fallbackRenderer = new Mock<IBundleHtmlRenderer<StylesheetBundle>>(); renderer = new ExternalStylesheetHtmlRenderer(fallbackRenderer.Object, settings); bundle = new ExternalStylesheetBundle("http://test.com/"); }
public ExternalStylesheetHtmlRenderer_Tests() { settings = new CassetteSettings(); fallbackRenderer = new Mock <IBundleHtmlRenderer <StylesheetBundle> >(); renderer = new ExternalStylesheetHtmlRenderer(fallbackRenderer.Object, settings); bundle = new ExternalStylesheetBundle("http://test.com/"); }
public void GivenDifferentUrls_ThenExternalStylesheetBundlesNotEqual() { var b1 = new ExternalStylesheetBundle("http://test1.com/a", "a"); var b2 = new ExternalStylesheetBundle("http://test2.com/a", "a"); b1.Equals(b2).ShouldBeFalse(); }
void RenderLink(StringBuilder html, ExternalStylesheetBundle bundle) { html.AppendFormat( HtmlConstants.LinkHtml, bundle.url, bundle.HtmlAttributes.CombinedAttributes ); }
public ExternalStylesheetBundleRender_Tests() { settings = new CassetteSettings(""); fallbackRenderer = new Mock <IBundleHtmlRenderer <StylesheetBundle> >(); bundle = new ExternalStylesheetBundle("http://test.com/") { Processor = new StylesheetPipeline() }; }
public ExternalStylesheetBundleRender_Tests() { settings = new CassetteSettings(); fallbackRenderer = new Mock<IBundleHtmlRenderer<StylesheetBundle>>(); bundle = new ExternalStylesheetBundle("http://test.com/") { Pipeline = Mock.Of<IBundlePipeline<StylesheetBundle>>() }; }
public void ProcessCallsProcessor() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var processor = new Mock<IBundleProcessor<StylesheetBundle>>(); bundle.Processor = processor.Object; bundle.Process(new CassetteSettings("")); processor.Verify(p => p.Process(bundle, It.IsAny<CassetteSettings>())); }
public void ProcessCallsProcessor() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var pipeline = new Mock<IBundlePipeline<StylesheetBundle>>(); bundle.Pipeline = pipeline.Object; bundle.Process(new CassetteSettings()); pipeline.Verify(p => p.Process(bundle)); }
public void ProcessCallsProcessor() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var processor = new Mock <IBundleProcessor <StylesheetBundle> >(); bundle.Processor = processor.Object; bundle.Process(new CassetteSettings("")); processor.Verify(p => p.Process(bundle, It.IsAny <CassetteSettings>())); }
public string Render(ExternalStylesheetBundle bundle) { if (settings.IsDebuggingEnabled && bundle.Assets.Any()) { return(bundle.FallbackRenderer.Render(bundle)); } var conditionalRenderer = new ConditionalRenderer(); return(conditionalRenderer.Render(bundle.Condition, html => RenderLink(html, bundle))); }
public void ProcessCallsProcessor() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var pipeline = new Mock <IBundlePipeline <StylesheetBundle> >(); bundle.Pipeline = pipeline.Object; bundle.Process(new CassetteSettings()); pipeline.Verify(p => p.Process(bundle)); }
public ExternalStylesheetBundleSerializer_Tests() { bundle = new ExternalStylesheetBundle("http://example.com/", "~") { Hash = new byte[0], Media = "MEDIA", Condition = "CONDITION", Renderer = new ConstantHtmlRenderer <StylesheetBundle>("", new VirtualDirectoryPrepender("/")) }; SerializeToElement(); }
public ExternalStylesheetBundleSerializer_Tests() { bundle = new ExternalStylesheetBundle("http://example.com/", "~") { Hash = new byte[0], Media = "MEDIA", Condition = "CONDITION", Renderer = new ConstantHtmlRenderer<StylesheetBundle>("", new VirtualDirectoryPrepender("/")) }; SerializeToElement(); }
public ExternalStylesheetBundleSerializer_Tests() { bundle = new ExternalStylesheetBundle("http://example.com/", "~") { Hash = new byte[0], Media = "MEDIA", Condition = "CONDITION", FallbackRenderer = new StylesheetHtmlRenderer(Mock.Of <IUrlGenerator>()), Renderer = new ExternalStylesheetBundle.ExternalStylesheetBundleRenderer(new CassetteSettings()) }; SerializeToElement(); }
public ExternalStylesheetBundleSerializer_Tests() { bundle = new ExternalStylesheetBundle("http://example.com/", "~") { Hash = new byte[0], Media = "MEDIA", Condition = "CONDITION", FallbackRenderer = new StylesheetHtmlRenderer(Mock.Of<IUrlGenerator>()), Renderer = new ExternalStylesheetBundle.ExternalStylesheetBundleRenderer(new CassetteSettings()) }; SerializeToElement(); }
public void RenderUsesRenderer() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var urlGenerator = new Mock<IUrlGenerator>(); urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("/"); var settings = new CassetteSettings("") { UrlGenerator = urlGenerator.Object }; bundle.Process(settings); var html = bundle.Render(); html.ShouldContain(bundle.Url); }
public void RenderUsesRenderer() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css"); var urlGenerator = new Mock <IUrlGenerator>(); urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("/"); var settings = new CassetteSettings("") { UrlGenerator = urlGenerator.Object }; bundle.Process(settings); var html = bundle.Render(); html.ShouldContain(bundle.Url); }
public void GivenMediaNotEmpty_RenderReturnsHtmlLinkElementWithMediaAttribute() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css") { Media = "print" }; var urlGenerator = new Mock<IUrlGenerator>(); urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("/"); var settings = new CassetteSettings("") { UrlGenerator = urlGenerator.Object }; bundle.Process(settings); var html = bundle.Render(); html.ShouldContain(bundle.Url); html.ShouldContain("media=\"print\""); }
public void GivenMediaNotEmpty_RenderReturnsHtmlLinkElementWithMediaAttribute() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css") { Media = "print" }; var urlGenerator = new Mock <IUrlGenerator>(); urlGenerator.Setup(g => g.CreateBundleUrl(bundle)).Returns("/"); var settings = new CassetteSettings("") { UrlGenerator = urlGenerator.Object }; bundle.Process(settings); var html = bundle.Render(); html.ShouldContain(bundle.Url); html.ShouldContain("media=\"print\""); }
void DeserializeElement() { bundle = reader.Deserialize(element, directory); }
public void CanCreateNamedBundle() { var bundle = new ExternalStylesheetBundle("http://url.com/", "~/name"); bundle.Path.ShouldEqual("~/name"); }
public void CreateNamedBundle_ThenPathIsAppRelative() { var bundle = new ExternalStylesheetBundle("http://url.com/", "name"); bundle.Path.ShouldEqual("~/name"); }
public void CreateWithOnlyUrl_ThenPathIsUrl() { var bundle = new ExternalStylesheetBundle("http://test.com/api.css"); bundle.Path.ShouldEqual("http://test.com/api.css"); }
public void GivenBundleHasName_WhenContainsPathUrl_ThenReturnTrue() { var bundle = new ExternalStylesheetBundle("http://test.com/asset.css", "test"); bundle.ContainsPath("http://test.com/asset.css").ShouldBeTrue(); }