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");
 }