public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); var dbpath = The.Root.Navigate((FilePath)"group1/proj2/DatabaseScripts"); _filesystem.Exists(null).ReturnsForAnyArgs(c=> c.Args()[0] as FilePath == dbpath); _filesystem.SortedDescendants(null,null).ReturnsForAnyArgs(new [] {(FilePath)"one",(FilePath)"two"}); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) }; _modules.CreateAndSetLocks().Returns(_locks); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _buildCmd = Substitute.For<IBuildCmd>(); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd); _subject.Prepare(); _subject.RebuildDatabases(); }
static void Main(string[] args) { var start = DateTime.Now; if (args.Length > 0 && args[0].Contains("help")) { ShowHelp(); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; if (args.Length > 0) Log.SetLevel(args[0]); else Log.SetLevel("status"); var runDbs = !(args.Any(a => a == "no-databases")); var files = new RealFileSystem(); var rules = new RuleFactory(files.GetPlatformRoot(), files); var deps = new DependencyManager(rules.GetRulePatterns()); var git = new Git(); var build = new BuildCmd(rules.GetRulePatterns(), files); var thing = new Builder(files, git, deps, rules, build); thing.Prepare(); thing.RunBuild(runDbs); var end = DateTime.Now; Console.WriteLine("Completed " + end + ", took " + (end - start)); }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _filesystem.Exists(null).ReturnsForAnyArgs(true); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] { "group1/proj1", "group1/proj2", "group2/proj3" }); _modules.Repos.Returns(new[] { "p1Repo", "p2Repo", "p3Repo" }); _locks = new List<AutoResetEvent> { new AutoResetEvent(true), new AutoResetEvent(true), new AutoResetEvent(true) }; _modules.CreateAndSetLocks().Returns(_locks); _patterns = new Patterns { DependencyPattern = "*.dll", DependencyPath = (FilePath)"lib", Masters = new FilePath[] { } }; _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _ruleFac.GetRulePatterns().Returns(_patterns); _buildCmd = Substitute.For<IBuildCmd>(); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, _buildCmd); _subject.Prepare(); _subject.GetDependenciesAndBuild(); }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _missingRepo = The.Root.Append((FilePath)"/group1/proj2"); _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath !=_missingRepo)); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null); _subject.Prepare(); }
public void builder() { _filesystem = Substitute.For<IFileSystem>(); _filesystem.GetPlatformRoot().Returns(The.Root); _filesystem.Exists(null).ReturnsForAnyArgs(c=> (c.Args()[0] as FilePath != (FilePath)"group1/proj2")); _modules = Substitute.For<IModules>(); _modules.Paths.Returns(new[] {"group1/proj1", "group1/proj2", "group2/proj3"}); _modules.Repos.Returns(new[] {"p1Repo", "p2Repo", "p3Repo"}); _locks = new List<AutoResetEvent> { new AutoResetEvent(false), new AutoResetEvent(false), new AutoResetEvent(false) }; _modules.CreateAndSetLocks().Returns(_locks); _git = Substitute.For<IGit>(); _depMgr = Substitute.For<IDependencyManager>(); _ruleFac = Substitute.For<IRuleFactory>(); _ruleFac.GetModules().Returns(_modules); _subject = new Builder(_filesystem, _git, _depMgr, _ruleFac, null); _subject.Prepare(); _subject.PullRepos(); }