public void ordering_test() { theGraph.Dependency("A", "B"); theGraph.Dependency("A", "C"); theGraph.Extension("D", "A"); theGraph.Extension("F", "B"); theGraph.CompileDependencies(new PackageLog()); var a = theGraph.FileDependencyFor("A"); var b = theGraph.FileDependencyFor("B"); var c = theGraph.FileDependencyFor("C"); var d = theGraph.FileDependencyFor("D"); var f = theGraph.FileDependencyFor("F"); f.MustBeAfter(c).ShouldBeFalse(); b.MustBeAfter(c).ShouldBeFalse(); a.MustBeAfter(b).ShouldBeTrue(); a.MustBeAfter(c).ShouldBeTrue(); d.MustBeAfter(a).ShouldBeTrue(); d.MustBeAfter(b).ShouldBeTrue(); d.MustBeAfter(c).ShouldBeTrue(); f.MustBeAfter(b).ShouldBeTrue(); IEnumerable <string> theNames = theGraph.GetAssets(new string[] { "A" }).Select(x => x.Name).ToList(); theNames.Each(x => Debug.WriteLine(x)); theNames.ShouldHaveTheSameElementsAs("B", "C", "F", "A", "D"); }
public AjaxContinuation get_dependencies_type(AssetDependenciesRequest request) { var logs = _assetLogs.Entries .Select(l => l.Name); IEnumerable <IGrouping <string, string> > fileNames = logs.GroupBy(x => new FileInfo(x).Extension); var javascripts = fileNames.Where(g => g.Key == ".js"); object data = null; foreach (var javascript in javascripts) { var dependencies = javascript.Select(x => _graph.FileDependencyFor(x)); data = dependencies.Select(d => new { d, fromName = d.Name }).SelectMany(@t => @t.d.Dependencies(), (@t, sub) => new { source = @t.fromName, target = sub.Name, type = "suit" }); } var datum = AjaxContinuation.Successful(); datum["datum"] = data; return(datum); }