public ExternalStylesheetHtmlRenderer_Tests()
 {
     settings = new CassetteSettings("");
     fallbackRenderer = new Mock<IBundleHtmlRenderer<StylesheetBundle>>();
     renderer = new ExternalStylesheetHtmlRenderer(fallbackRenderer.Object, settings);
     bundle = new ExternalStylesheetBundle("http://test.com/");
 }
예제 #2
0
 public ExternalStylesheetHtmlRenderer_Tests()
 {
     settings         = new CassetteSettings();
     fallbackRenderer = new Mock <IBundleHtmlRenderer <StylesheetBundle> >();
     renderer         = new ExternalStylesheetHtmlRenderer(fallbackRenderer.Object, settings);
     bundle           = new ExternalStylesheetBundle("http://test.com/");
 }
예제 #3
0
        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();
        }
예제 #4
0
 void RenderLink(StringBuilder html, ExternalStylesheetBundle bundle)
 {
     html.AppendFormat(
         HtmlConstants.LinkHtml,
         bundle.url,
         bundle.HtmlAttributes.CombinedAttributes
         );
 }
예제 #5
0
 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));
        }
예제 #9
0
        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>()));
        }
예제 #10
0
            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)));
            }
예제 #11
0
        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);
        }
예제 #17
0
        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\"");
        }
예제 #19
0
        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);
 }
예제 #21
0
 public void CanCreateNamedBundle()
 {
     var bundle = new ExternalStylesheetBundle("http://url.com/", "~/name");
     bundle.Path.ShouldEqual("~/name");
 }
예제 #22
0
        public void CreateNamedBundle_ThenPathIsAppRelative()
        {
            var bundle = new ExternalStylesheetBundle("http://url.com/", "name");

            bundle.Path.ShouldEqual("~/name");
        }
예제 #23
0
        public void CreateWithOnlyUrl_ThenPathIsUrl()
        {
            var bundle = new ExternalStylesheetBundle("http://test.com/api.css");

            bundle.Path.ShouldEqual("http://test.com/api.css");
        }
예제 #24
0
        public void CanCreateNamedBundle()
        {
            var bundle = new ExternalStylesheetBundle("http://url.com/", "~/name");

            bundle.Path.ShouldEqual("~/name");
        }
 void DeserializeElement()
 {
     bundle = reader.Deserialize(element, directory);
 }
예제 #26
0
 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();
 }
예제 #27
0
 public void GivenBundleHasName_WhenContainsPathUrl_ThenReturnTrue()
 {
     var bundle = new ExternalStylesheetBundle("http://test.com/asset.css", "test");
     bundle.ContainsPath("http://test.com/asset.css").ShouldBeTrue();
 }
예제 #28
0
 public void CreateWithOnlyUrl_ThenPathIsUrl()
 {
     var bundle = new ExternalStylesheetBundle("http://test.com/api.css");
     bundle.Path.ShouldEqual("http://test.com/api.css");
 }
예제 #29
0
        public void GivenBundleHasName_WhenContainsPathUrl_ThenReturnTrue()
        {
            var bundle = new ExternalStylesheetBundle("http://test.com/asset.css", "test");

            bundle.ContainsPath("http://test.com/asset.css").ShouldBeTrue();
        }
예제 #30
0
 public void CreateNamedBundle_ThenPathIsAppRelative()
 {
     var bundle = new ExternalStylesheetBundle("http://url.com/", "name");
     bundle.Path.ShouldEqual("~/name");
 }