public void Typical() { string[] files = { "Class.SuperClass.js", "Foo.UnknownSuperClass.js", "NoSuperClass.js", "Subclass.Class.js", "SuperClass.js" }; Build build = new Build(); foreach (BuildUnit unit in files.Select(file => new BuildUnit(file))) { build.Add(unit); } string[] expected = { "Foo.UnknownSuperClass.js", "NoSuperClass.js", "SuperClass.js", "Class.SuperClass.js", "Subclass.Class.js" }; BuildUnit[] sortedBuildFiles = build.SortBuildUnits().ToArray(); for (int i = 0; i < sortedBuildFiles.Count(); i++) { Assert.AreEqual(expected[i], sortedBuildFiles[i].JsFileName); } }
/// <summary> /// Combine the output of the supplied build to create the project's /// output files. /// </summary> /// <remarks> /// If there are no build files of a given type, no combined output file /// for that type will be created. /// </remarks> public void Combine(Build build) { // See if we need to recombine either of the combined files. bool combineJsFile = RequiresCombining(build.JsFiles, CombinedJsFile); bool combineCssFile = RequiresCombining(build.CssFiles, CombinedCssFile); // Only do the work if the combined files are out of date. if (combineJsFile || combineCssFile) { IEnumerable<BuildUnit> buildUnits = build.SortBuildUnits(); if (combineJsFile) { CombineFile(buildUnits, CombinedJsFile); } if (combineCssFile) { CombineFile(buildUnits, CombinedCssFile); } } }