public void applies_to_positive_and_negative_based_on_other_criteria() { var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript, typeof(StubTransformer)); policy.AddMatchingCriteria(file => file.Name.StartsWith("yes")); policy.AppliesTo(new AssetFile("yes.js")).ShouldBeTrue(); policy.AppliesTo(new AssetFile("no.js")).ShouldBeFalse(); }
public void applies_to_positive_and_negative_based_on_other_criteria() { var policy = new TransformerPolicy(ActionType.Transformation, MimeType.Javascript, typeof(StubTransformer)); policy.AddMatchingCriteria(file => file.Name.StartsWith("yes")); policy.AddExclusionCriteria(f => f.Name.Contains(".man.")); policy.AppliesTo(new AssetFile("yes.js")).ShouldBeTrue(); policy.AppliesTo(new AssetFile("yes.man.js")).ShouldBeFalse(); policy.AppliesTo(new AssetFile("no.js")).ShouldBeFalse(); }
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(); }