static void Main() { var fs = new FileSystemHelper(); var commandLineProgram = new CommandLineProgram(); var processRunner = new ProcessRunner(commandLineProgram); var outputWriter = new OutputWriter(); var nodeModulesHelper = new NodeModulesHelper(processRunner, fs); var systemDependencyChecker = new SystemDependencyChecker(outputWriter); var systemDependencies = new ISystemDependency[] { new NodeJsSystemDependency(processRunner), new KarmaSystemDependency(processRunner, nodeModulesHelper), new KarmaSpecReporterSystemDependency(nodeModulesHelper, fs), new KarmaJunitReporterSystemDependency(nodeModulesHelper, fs), /*Example of checking express*/ /*new NodeModuleSystemDependency("express", nodeModulesHelper, fs)*/ }; foreach (ISystemDependency systemDependency in systemDependencies) { systemDependencyChecker.CheckSystemDependency(systemDependency); if (systemDependency is ISystemDependencyWithVersion) { systemDependencyChecker.CheckSystemDependencyVersion(systemDependency as ISystemDependencyWithVersion); } } Console.WriteLine("Press any key to continue..."); Console.Read(); }
public void Then_process_is_executed() { var commandLineProgram = new CommandLineProgram(); var commandResult = (CommandLineResult) null; Assert.DoesNotThrow(() => { commandResult = commandLineProgram.Execute("TestProgram.exe"); }); Assert.NotNull(commandResult); Assert.That(commandResult.Output, Is.EqualTo("TEST-")); }
public void Setup_when_program_is_defined() { this.program = new CommandLineProgram( () => { this.prepared = true; return null; }, (info, opt) => { this.ran = true; return this.result; }); }
public void Then_process_is_executed() { var commandLineProgram = new CommandLineProgram(() => new ProcessStartInfo() { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }); var commandResult = (CommandLineResult) null; Assert.DoesNotThrow(() => { commandResult = commandLineProgram.Execute("TestProgram.exe"); }); Assert.NotNull(commandResult); Assert.That(commandResult.Output, Is.EqualTo("TEST-")); }
public void Then_should_pass_prepared_process_info_in_eventargs() { const string preparedFilename = "PREPARED"; var passedFilename = string.Empty; var program = new CommandLineProgram( () => new ProcessStartInfo { FileName = preparedFilename }, (info, opt) => null ); program.Executing = (o, e) => passedFilename = e.ProcessStartInfo.FileName; program.Execute(); Assert.AreEqual(preparedFilename, passedFilename); }
public void Then_should_raise_executed_event() { var program = new CommandLineProgram( () => null, (info, opt) => null ); var eventraised = false; program.Executed = (o, e) => eventraised = true; program.Execute(); Assert.IsTrue(eventraised); }
public For_execution_with_run_option() { this.options = CommandLineRunOptions.None; this.program = new CommandLineProgram( () => new ProcessStartInfo(), (info, opt) => { this.options = opt; return null; }); }
public void Then_should_contain_arguments_in_processinfo() { const string preparedArguments = "arg"; var passedArguments = string.Empty; var program = new CommandLineProgram( () => new ProcessStartInfo(), (info, opt) => null ); program.Executing = (o, e) => { passedArguments = e.ProcessStartInfo.Arguments; }; program.Execute("TestProgram.exe", new[] { preparedArguments }); Assert.AreEqual(preparedArguments, passedArguments); }
public void Then_should_contain_filename_in_processinfo() { const string preparedFilename = "TestProgram.exe"; var passedFilename = string.Empty; var program = new CommandLineProgram( () => new ProcessStartInfo(), (info, opt) => null ); program.Executing = (o, e) => passedFilename = e.ProcessStartInfo.FileName; program.Execute(preparedFilename); Assert.AreEqual(preparedFilename, passedFilename); }
public ProcessRunner(CommandLineProgram commandLineProgram) { _commandLineProgram = commandLineProgram; }