public void matching_extension_position()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                               typeof(StubTransformer));

            policy.MatchingExtensionPosition(new[] { ".js", ".coffee" }).HasValue.ShouldBeFalse();
            policy.AddExtension(".coffee");
            policy.AddExtension(".else");
            policy.MatchingExtensionPosition(new[] { ".js", ".coffee" }).ShouldEqual(1);
        }
        public void applies_to_negative_based_on_exclusion_criteria()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript, typeof(StubTransformer));

            policy.AddExtension(".js");
            policy.AddExtension(".coffee");
            policy.AddExclusionCriteria(f => f.Name.Contains(".min."));

            policy.AppliesTo(new AssetFile("a.min.coffee")).ShouldBeFalse();
            policy.AppliesTo(new AssetFile("b.coffee")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("c.min.js")).ShouldBeFalse();
            policy.AppliesTo(new AssetFile("d.a.js")).ShouldBeTrue();
        }
        public void applies_to_negative_based_on_exclusion_criteria()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript, typeof(StubTransformer));

            policy.AddExtension(".js");
            policy.AddExtension(".coffee");
            policy.AddExclusionCriteria(f => f.Name.Contains(".min."));

            policy.AppliesTo(new AssetFile("a.min.coffee")).ShouldBeFalse();
            policy.AppliesTo(new AssetFile("b.coffee")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("c.min.js")).ShouldBeFalse();
            policy.AppliesTo(new AssetFile("d.a.js")).ShouldBeTrue();
        }
        public void applies_to_positive_based_on_mimetype()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                               typeof(StubTransformer));

            policy.AddExtension(".coffee");
            policy.AddExtension(".cf");

            policy.AppliesTo(new AssetFile("script.coffee")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.coffee.js")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.cf")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.cf.js")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.something.cf.js")).ShouldBeTrue();
        }
        public void applies_to_negative_on_all()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                               typeof(StubTransformer));

            policy.AddExtension(".coffee");

            var file = new AssetFile("script.js");

            policy.AppliesTo(file).ShouldBeFalse();
        }
        public void applies_to_negative_on_all()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                                  typeof(StubTransformer));

            policy.AddExtension(".coffee");

            var file = new AssetFile("script.js");

            policy.AppliesTo(file).ShouldBeFalse();
        }
        public void applies_to_positive_based_on_mimetype()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                                  typeof(StubTransformer));

            policy.AddExtension(".coffee");
            policy.AddExtension(".cf");

            policy.AppliesTo(new AssetFile("script.coffee")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.coffee.js")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.cf")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.cf.js")).ShouldBeTrue();
            policy.AppliesTo(new AssetFile("script.something.cf.js")).ShouldBeTrue();
        }
        public void matching_extension_position()
        {
            var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript,
                                                  typeof (StubTransformer));

            policy.MatchingExtensionPosition(new[]{".js", ".coffee"}).HasValue.ShouldBeFalse();
            policy.AddExtension(".coffee");
            policy.AddExtension(".else");
            policy.MatchingExtensionPosition(new[] { ".js", ".coffee" }).ShouldEqual(1);
        }