public AssetTagPlan BuildPlan(MimeType mimeType, IEnumerable <string> names) { var plan = new AssetTagPlan(mimeType); plan.AddSubjects(FindSubjects(names)); validateMatchingMimetypes(mimeType, plan, names); if (plan.Subjects.Count == 1) { return(plan); } _combinations.TryToReplaceWithCombinations(plan); return(plan); }
public void skip_over_non_files_in_the_plan() { var files = new IAssetTagSubject[] { new AssetFile("a.js"), new AssetFile("b.js"), new MissingAssetTagSubject("something.wrong"), new AssetFile("c.js"), new AssetFile("d.js"), new MissingAssetTagSubject("else.wrong"), new AssetFile("e.js") }; var plan = new AssetTagPlan(MimeType.Javascript); plan.AddSubjects(files); var combos = new CombineAllScriptFiles().DetermineCombinations(plan); combos.Count().ShouldEqual(2); combos.First().Files.Select(x => x.Name).ShouldHaveTheSameElementsAs("a.js", "b.js"); combos.Last().Files.Select(x => x.Name).ShouldHaveTheSameElementsAs("c.js", "d.js"); }