public void DoFullRun() { if (licenseIsInvalid()) { return; } var message = new ProjectChangeMessage(); var cache = BootStrapper.Services.Locate <ICache>(); var configuration = BootStrapper.Services.Locate <IConfiguration>(); var bus = BootStrapper.Services.Locate <IMessageBus>(); var projects = cache.GetAll <Project>(); foreach (var project in projects) { if (project.Value == null) { Logger.WriteDebug("Invalid project does not contain.Value " + project.Key); continue; } project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } _resumeMinimizerOnNextRunCompleted = true; pauseMinimizer(); notifyMinimizerAboutFullRun(); bus.Publish(message); }
public Dictionary <string, Action <dynamic> > GetClientHandlers() { var handlers = new Dictionary <string, Action <dynamic> >(); handlers.Add("build-test-all", (msg) => { var message = new ProjectChangeMessage(); var projects = _cache.GetAll <Project>(); foreach (var project in projects) { if (project.Value == null) { continue; } project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } _bus.Publish(message); }); handlers.Add("build-test-projects", (msg) => { var message = new ProjectChangeMessage(); var projects = ((IEnumerable <object>)msg.projects).Select(x => x.ToString()); projects.ToList().ForEach(x => message.AddFile(new ChangedFile(x))); _bus.Publish(message); }); return(handlers); }
public void Should_rerun_test_if_pre_processor_says_so() { _runInfo.ShouldNotBuild(); _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); var info = new TestRunInfo(_project, ""); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); var result = new TestRunResults[] { new TestRunResults("", "", false, TestRunner.NUnit, new TestResult[] { }) }; _testRunner.Stub(t => t.CanHandleTestFor(info.Assembly)).IgnoreArguments().Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { info }, null, null)).IgnoreArguments() .Return(result); _runInfo.ShouldRerunAllTestWhenFinishedFor(TestRunner.Any); _removedTestLocator.Stub(r => r.SetRemovedTestsAsPassed(null, null)).IgnoreArguments().Return(result[0]); _removedTestLocator.Stub(r => r.RemoveUnmatchedRunInfoTests(null, null)).IgnoreArguments().Return(new List <TestRunResults>()); _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly("")).IgnoreArguments().Return(false); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _testRunner.AssertWasCalled(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(null, "") }, null, null), t => t.IgnoreArguments().Repeat.Twice()); }
public void DoPartialRun(IEnumerable <string> projects) { var message = new ProjectChangeMessage(); projects.ToList().ForEach(x => message.AddFile(new ChangedFile(x))); var bus = BootStrapper.Services.Locate <IMessageBus>(); bus.Publish(message); }
public Dictionary <string, Action <dynamic> > GetClientHandlers() { var handlers = new Dictionary <string, Action <dynamic> >(); handlers.Add("build-test-all", (msg) => { var message = new ProjectChangeMessage(); var projects = _cache.GetAll <Project>(); foreach (var project in projects) { if (project.Value == null) { continue; } project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } _bus.Publish(message); }); handlers.Add("build-test-projects", (msg) => { var message = new ProjectChangeMessage(); var projects = ((IEnumerable <object>)msg.projects).Select(x => x.ToString()); projects.ToList().ForEach(x => message.AddFile(new ChangedFile(x))); _bus.Publish(message); }); handlers.Add("on-demand-test-run", (msg) => { var runs = ((IEnumerable <dynamic>)msg.runs) .Select(x => { var run = new OnDemandRun( x.project.ToString(), ((IEnumerable <dynamic>)x.tests).Select(y => y.ToString()).ToArray(), ((IEnumerable <dynamic>)x.members).Select(y => y.ToString()).ToArray(), ((IEnumerable <dynamic>)x.namespaces).Select(y => y.ToString()).ToArray() ); if ((bool)x.project_runall_tests == true) { run.ShouldRunAllTestsInProject(); } return(run); }); var message = new ProjectChangeMessage(); var projects = _cache.GetAll <Project>(); Debug.WriteDebug(string.Format("Recieved {0} runs", runs.Count())); addProjects(runs, message, projects); var onDemandPreProcessor = getOnDemandPreProcessor(); foreach (var run in runs) { Debug.WriteDebug("Adding test run to preprocessor " + run.Project); onDemandPreProcessor.AddRuns(run); } onDemandPreProcessor.Activate(); _disableOnDemandRunnerOnNextRunCompleted = true; _bus.Publish(message); }); return(handlers); }
private ProjectChangeMessage getProjects(TempFiles files) { var message = new ProjectChangeMessage(); foreach (var file in files.Files) { var project = _cache.Get<Project>(file.Original); if (project == null) continue; message.AddFile(new ChangedFile(project.Key)); } return message; }
private void publishProjects(List <ChangedFile> totalListOfProjects) { if (totalListOfProjects.Count == 0) { return; } var projectChange = new ProjectChangeMessage(); projectChange.AddFile(totalListOfProjects.ToArray()); Debug.AboutToPublishProjectChanges(projectChange); _bus.Publish(projectChange); }
public void Should_run_builds() { var executable = Assembly.GetExecutingAssembly().Location; _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return(executable); _buildRunner.Stub(b => b.RunBuild(_project.Key, executable)).Return(new BuildRunResults("")); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _buildRunner.AssertWasCalled(b => b.RunBuild(_project.Key, executable)); }
public void Should_not_run_builds_when_build_executable_not_defined() { var executable = Assembly.GetExecutingAssembly().Location; _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("non existing file"); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _buildRunner.AssertWasNotCalled(b => b.RunBuild(_runInfo, executable, null), b => b.IgnoreArguments()); }
private void addProjects(IEnumerable <OnDemandRun> runs, ProjectChangeMessage message, Project[] projects) { foreach (var run in runs) { var project = projects.FirstOrDefault(x => x.Key.Equals(run.Project)); if (project == null) { Logger.WriteError(string.Format("Did not find matching project for run {0}", run.Project)); continue; } message.AddFile(new ChangedFile(run.Project)); } }
private ProjectChangeMessage getProjects(TempFiles files) { var message = new ProjectChangeMessage(); foreach (var file in files.Files) { var project = _cache.Get <Project>(file.Original); if (project == null) { continue; } message.AddFile(new ChangedFile(project.Key)); } return(message); }
private ProjectChangeMessage getOnDemandMessage(IEnumerable <OnDemandRun> runs, Project[] projects) { var message = new ProjectChangeMessage(); foreach (var run in runs) { var project = projects.Where(x => x.Key.Equals(run.Project)).FirstOrDefault(); if (project == null) { Debug.WriteError(string.Format("Did not find matching project for run {0}", run.Project)); continue; } message.AddFile(new ChangedFile(run.Project)); } return(message); }
public void BuildAndTestAll() { var message = new ProjectChangeMessage(); var cache = BootStrapper.Services.Locate <ICache>(); var bus = BootStrapper.Services.Locate <IMessageBus>(); var projects = cache.GetAll <Project>(); foreach (var project in projects) { if (project.Value == null) { continue; } project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } bus.Publish(message); }
public void Should_pre_process_run_information() { _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); var info = new TestRunInfo(_project, "someProject.dll"); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); _testRunner.Stub(t => t.CanHandleTestFor(info.Assembly)).Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { info }, null, null)).IgnoreArguments() .Return(new TestRunResults[] { new TestRunResults("", "", false, TestRunner.NUnit, new TestResult[] { }) }); _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly("")).IgnoreArguments().Return(true); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _preProcessor.AssertWasCalled(p => p.PreProcess(null), p => p.IgnoreArguments()); }
private ProjectChangeMessage getOnDemandMessage(IEnumerable<OnDemandRun> runs, Project[] projects) { var message = new ProjectChangeMessage(); foreach (var run in runs) { var project = projects.Where(x => x.Key.Equals(run.Project)).FirstOrDefault(); if (project == null) { Debug.WriteError(string.Format("Did not find matching project for run {0}", run.Project)); continue; } message.AddFile(new ChangedFile(run.Project)); } return message; }
public void BuildAndTestAll() { var message = new ProjectChangeMessage(); var cache = BootStrapper.Services.Locate<ICache>(); var bus = BootStrapper.Services.Locate<IMessageBus>(); var projects = cache.GetAll<Project>(); foreach (var project in projects) { if (project.Value == null) continue; project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } bus.Publish(message); }
public void Should_run_tests() { _project.Value.SetAsNUnitTestContainer(); _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); _testRunner.Stub(t => t.CanHandleTestFor(_project.Value)).Return(true); var result = new TestRunResults[] { new TestRunResults("", "", false, new TestResult[] { }) }; _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(_project, "") })).IgnoreArguments() .Return(result); _removedTestLocator.Stub(r => r.SetRemovedTestsAsPassed(null, null)).IgnoreArguments().Return(result[0]); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _testRunner.AssertWasCalled(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(null, "") }), t => t.IgnoreArguments()); }
private void addProjects(IEnumerable<OnDemandRun> runs, ProjectChangeMessage message, Project[] projects) { foreach (var run in runs) { var project = projects.FirstOrDefault(x => x.Key.Equals(run.Project)); if (project == null) { Logger.WriteError(string.Format("Did not find matching project for run {0}", run.Project)); continue; } message.AddFile(new ChangedFile(run.Project)); } }
public void Should_rerun_test_if_pre_processor_says_so() { _runInfo.ShouldNotBuild(); _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); var info = new TestRunInfo(_project, ""); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); var result = new TestRunResults[] { new TestRunResults("", "", false, TestRunner.NUnit, new TestResult[] { }) }; _testRunner.Stub(t => t.CanHandleTestFor(info.Assembly)).IgnoreArguments().Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { info })).IgnoreArguments() .Return(result); _runInfo.ShouldRerunAllTestWhenFinishedFor(TestRunner.Any); _removedTestLocator.Stub(r => r.SetRemovedTestsAsPassed(null, null)).IgnoreArguments().Return(result[0]); _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly("")).IgnoreArguments().Return(false); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _testRunner.AssertWasCalled(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(null, "") }), t => t.IgnoreArguments().Repeat.Twice()); }
public void Should_not_run_builds_when_build_executable_not_defined() { var executable = Assembly.GetExecutingAssembly().Location; _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("non existing file"); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _buildRunner.AssertWasNotCalled(b => b.RunBuild(_runInfo, executable, null), b => b.IgnoreArguments()); }
public void Should_pre_process_run_information() { _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); var info = new TestRunInfo(_project, "someProject.dll"); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); _testRunner.Stub(t => t.CanHandleTestFor(info.Assembly)).Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { info })).IgnoreArguments() .Return(new TestRunResults[] { new TestRunResults("", "", false, TestRunner.NUnit, new TestResult[] { }) }); _testAssemblyValidator.Stub(t => t.ShouldNotTestAssembly("")).IgnoreArguments().Return(true); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _preProcessor.AssertWasCalled(p => p.PreProcess(null), p => p.IgnoreArguments()); }
public void DoFullRun() { if (licenseIsInvalid()) return; var message = new ProjectChangeMessage(); var cache = BootStrapper.Services.Locate<ICache>(); var configuration = BootStrapper.Services.Locate<IConfiguration>(); var bus = BootStrapper.Services.Locate<IMessageBus>(); var projects = cache.GetAll<Project>(); foreach (var project in projects) { if (project.Value == null) { Logger.WriteDebug("Invalid project does not contain.Value " + project.Key); continue; } project.Value.RebuildOnNextRun(); message.AddFile(new ChangedFile(project.Key)); } _resumeMinimizerOnNextRunCompleted = true; pauseMinimizer(); notifyMinimizerAboutFullRun(); bus.Publish(message); }
public void Should_rerun_test_if_pre_processor_says_so() { _project.Value.SetAsNUnitTestContainer(); _project.Value.SetOutputPath(""); _project.Value.SetAssemblyName("someProject.dll"); _listGenerator.Stub(l => l.Generate(null)).IgnoreArguments().Return(new string[] { "some file.csproj" }); _configuration.Stub(c => c.BuildExecutable(_project.Value)).Return("invalid_to_not_run_builds.exe"); _testRunner.Stub(t => t.CanHandleTestFor(_project.Value)).Return(true); _testRunner.Stub(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(_project, "") })).IgnoreArguments() .Return(new TestRunResults[] { new TestRunResults("", "", new TestResult[] {}) }); _runInfo.RerunAllTestWhenFinished(); var message = new ProjectChangeMessage(); message.AddFile(new ChangedFile("some file.csproj")); _consumer.Consume(message); _testRunner.AssertWasCalled(t => t.RunTests(new TestRunInfo[] { new TestRunInfo(null, "") }), t => t.IgnoreArguments().Repeat.Twice()); }
public void DoPartialRun(IEnumerable<string> projects) { var message = new ProjectChangeMessage(); projects.ToList().ForEach(x => message.AddFile(new ChangedFile(x))); var bus = BootStrapper.Services.Locate<IMessageBus>(); bus.Publish(message); }