Execute() 공개 메소드

public Execute ( ) : CommandLineResult
리턴 CommandLineResult
            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 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 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);
            }