Example #1
0
        public void GivenPipelineWithEmbedImages_WhenProcessBundle_ThenLessAssetHasDataUriTransformAdded()
        {
            var asset = new Mock <IAsset>();

            asset.SetupGet(a => a.Path).Returns("~/file.less");
            asset.Setup(a => a.OpenStream()).Returns(Stream.Null);
            var bundle = new StylesheetBundle("~");

            bundle.Assets.Add(asset.Object);

            var pipeline = new StylesheetPipeline(container, settings);

            bundle.Pipeline = pipeline;
            bundle.EmbedImages();
            pipeline.Process(bundle);

            asset.Verify(a => a.AddAssetTransformer(It.Is <IAssetTransformer>(t => t is CssImageToDataUriTransformer)));
        }
 public void WhenEmbedImages_ThenPipelineContainsConvertImageUrlsToDataUris()
 {
     bundle.EmbedImages();
     AssertPipelineContains <ConvertImageUrlsToDataUris>();
 }
Example #3
0
        public void GivenPipelineWithEmbedImages_WhenProcessBundle_ThenLessAssetHasDataUriTransformAdded()
        {
            var asset = new Mock<IAsset>();
            asset.SetupGet(a => a.Path).Returns("~/file.less");
            asset.Setup(a => a.OpenStream()).Returns(Stream.Null);
            var bundle = new StylesheetBundle("~");
            bundle.Assets.Add(asset.Object);

            var pipeline = new StylesheetPipeline(container, settings);
            bundle.Pipeline = pipeline;
            bundle.EmbedImages();
            pipeline.Process(bundle);

            asset.Verify(a => a.AddAssetTransformer(It.Is<IAssetTransformer>(t => t is CssImageToDataUriTransformer)));
        }
Example #4
0
 public static StylesheetBundle EmbedImages(this StylesheetBundle bundle)
 {
     return(bundle.EmbedImages(url => true));
 }