Exemplo n.º 1
0
        public void AddFilesNoSourceFiles_Throws()
        {
            var pipeline    = new AssetPipeline();
            var sourceFiles = new string[0];
            var ex          = Assert.Throws <ArgumentException>(() => pipeline.AddFiles("text/css", sourceFiles));

            Assert.Equal("sourceFiles", ex.ParamName);
            Assert.Equal(0, pipeline.Assets.Count);
        }
Exemplo n.º 2
0
        public void AddFilesNoContentType_Throws()
        {
            var    pipeline = new AssetPipeline();
            string ct       = null;
            var    ex       = Assert.Throws <ArgumentException>(() => pipeline.AddFiles(ct, new[] { "file.css" }));

            Assert.Equal("contentType", ex.ParamName);
            Assert.Equal(0, pipeline.Assets.Count);
        }
Exemplo n.º 3
0
        public void FromRoute_Globbing_WithProcessors_Success(string pattern, string path)
        {
            var pipeline = new AssetPipeline();

            pipeline.AddFiles("text/css", pattern).MinifyCss();

            Assert.True(pipeline.TryGetAssetFromRoute(path, out var a1));
            Assert.Equal(1, a1.Processors.Count);
        }
Exemplo n.º 4
0
        public void FromRoute_Globbing_Success(string pattern, string path)
        {
            var pipeline = new AssetPipeline();

            pipeline.AddFiles("text/css", pattern);

            Assert.True(pipeline.TryGetAssetFromRoute(path, out var a1));
            Assert.Equal($"/{path.TrimStart('/')}", a1.Route);
        }
Exemplo n.º 5
0
        public void FromRoute_Globbing_WithItems_Success(string pattern, string path)
        {
            var pipeline = new AssetPipeline();

            pipeline.AddFiles("text/css", pattern).ForEach(x => x.UseContentRoot());

            Assert.True(pipeline.TryGetAssetFromRoute(path, out var a1));
            Assert.Equal($"/{path.TrimStart('/')}", a1.Route);
            Assert.Equal(1, a1.Items.Count);
            Assert.Contains(a1.Items, p => p.Key == "usecontentroot");
        }