public void FactoryShouldInitializeStartupCommands() { // Fixture setup var settings = new PowerShellWorkerSettings(); settings.StartupCommands.Add(new GetProcessCommand()); // Exercise system var worker = (PowerShellWorker)PowerShellWorkerFactory.Create(settings); var executor = (PowerShellExecutor)worker.Executor; // Verify outcome executor.StartupCommands.Should().BeEquivalentTo(settings.StartupCommands.Select(c => c.ToNativeCommand())); }
public void FactoryShouldInitializeRemoteAddress() { // Fixture setup var settings = new PowerShellWorkerSettings { RemoteAddress = "http://ya.ru" }; // Exercise system var worker = (PowerShellWorker)PowerShellWorkerFactory.Create(settings); var executor = (PowerShellExecutor)worker.Executor; // Verify outcome executor.RemoteAddress.Should().Be(settings.RemoteAddress); }
public void FactoryShouldInitializeShellName() { // Fixture setup var settings = new PowerShellWorkerSettings { ShellName = "Microsoft.Exchange" }; // Exercise system var worker = (PowerShellWorker)PowerShellWorkerFactory.Create(settings); var executor = (PowerShellExecutor)worker.Executor; // Verify outcome executor.ShellName.Should().Be(settings.ShellName); }
public void FactoryShouldInitializeSnapIns() { // Fixture setup var settings = new PowerShellWorkerSettings(); settings.SnapIns.Add("SnapIn1"); settings.SnapIns.Add("SnapIn2"); // Exercise system var worker = (PowerShellWorker)PowerShellWorkerFactory.Create(settings); var executor = (PowerShellExecutor)worker.Executor; // Verify outcome executor.SnapIns.Should().BeEquivalentTo(settings.SnapIns); }
public void FactoryWorkerTest() { // Fixture setup var command = new GetProcessCommand { ComputerName = Environment.MachineName }; var settings = new PowerShellWorkerSettings { RemoteAddress = Environment.MachineName }; var worker = PowerShellWorkerFactory.Create(settings); // Exercise system var results = worker.RunCommand(command); var sb = new StringBuilder(); results.ForEach(r => sb.AppendLine(r)); // Verify outcome WriteMessage(sb.ToString()); }