Beispiel #1
0
        public void it_should_populate_WorkingDirectory_property_with_the_value_of_WorkingDirectory_whistle_option()
        {
            var whistleOptions = WhistleOptionsGenerator.Default().WithWorkingDirectory("/TestDirectory");

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(whistleOptions.WorkingDirectory, processStartInformation.WorkingDirectory);
        }
Beispiel #2
0
        public void it_should_set_RedirectStandardOutput_property_to_true()
        {
            var whistleOptions = WhistleOptionsGenerator.Default();

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(true, processStartInformation.RedirectStandardOutput);
        }
Beispiel #3
0
        public void it_should_populate_FileName_property_with_the_value_of_ExecutableName_whistle_option()
        {
            var whistleOptions = WhistleOptionsGenerator.Default().WithExecutableName("TestApp.exe");

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(whistleOptions.ExecutableName, processStartInformation.FileName);
        }
Beispiel #4
0
        public void it_should_set_ErrorDialog_property_to_false()
        {
            var whistleOptions = WhistleOptionsGenerator.Default();

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(false, processStartInformation.ErrorDialog);
        }
Beispiel #5
0
        public void it_should_set_WindowStyle_property_to_be_hidden()
        {
            var whistleOptions = WhistleOptionsGenerator.Default();

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(ProcessWindowStyle.Hidden, processStartInformation.WindowStyle);
        }
Beispiel #6
0
        public void it_should_set_UseShellExecute_property_to_false()
        {
            var whistleOptions = WhistleOptionsGenerator.Default();

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(false, processStartInformation.UseShellExecute);
        }
Beispiel #7
0
        public void it_should_set_CreateNoWindow_property_to_true()
        {
            var whistleOptions = WhistleOptionsGenerator.Default();

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(true, processStartInformation.CreateNoWindow);
        }
Beispiel #8
0
        public void it_should_populate_Arguments_property_with_the_value_of_Arguments_whistle_option()
        {
            var whistleOptions =
                WhistleOptionsGenerator.Default().WithArguments(new List <string> {
                "http://www.google.com/", "-t 1000"
            });

            var expected = "http://www.google.com/ -t 1000";

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            Assert.AreEqual(expected, processStartInformation.Arguments);
        }
Beispiel #9
0
        public void it_should_populate_EnvironmentVariables_property_with_the_value_of_EnvironmentVariables_whistle_option()
        {
            var whistleOptions =
                WhistleOptionsGenerator.Default()
                .WithEnvironmentVariable("key1", "value1")
                .WithEnvironmentVariable("key2", "value2");

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions);

            foreach (KeyValuePair <string, string> environmentVariable in whistleOptions.EnvironmentVariables)
            {
                Assert.That(processStartInformation.EnvironmentVariables.ContainsKey(environmentVariable.Key));
                Assert.That(processStartInformation.EnvironmentVariables[environmentVariable.Key] ==
                            environmentVariable.Value);
            }
        }
Beispiel #10
0
        public void it_should_append_the_value_of_arguments_parameter_to_Arguments_property()
        {
            var whistleOptions =
                WhistleOptionsGenerator.Default().WithArguments(new List <string> {
                "http://www.google.com/", "-t 1000"
            });
            var extraArguments = new List <string> {
                "-c true", "-f sample.png"
            };

            var expected = "http://www.google.com/ -t 1000 -c true -f sample.png";

            var processStartInformation = _processStartInformationBuilder.Build(whistleOptions, extraArguments);

            Assert.AreEqual(expected, processStartInformation.Arguments);
        }
Beispiel #11
0
 public void SetUp()
 {
     _whistleOptions                 = WhistleOptionsGenerator.Default();
     _whistleOptionsValidator        = new Mock <IWhistleOptionsValidator>();
     _processStartInformationBuilder = new Mock <IProcessStartInformationBuilder>();
 }
 public void it_should_throw_ArgumentException_if_the_value_of_the_ExitTimeout_option_is_less_than_zero()
 {
     Assert.Throws <ArgumentException>(
         () => _whistleOptionsValidator.Validate(WhistleOptionsGenerator.Default().WithExitTimeout(-2)));
 }
 public void it_should_throw_ArgumentException_if_the_value_of_the_WorkingDirectory_option_is_a_non_existent_path()
 {
     Assert.Throws <ArgumentException>(
         () => _whistleOptionsValidator.Validate(WhistleOptionsGenerator.Default().WithNonExistentWorkingDirectory()));
 }
 public void it_should_throw_ArgumentException_if_ExecutableName_option_is_empty()
 {
     Assert.Throws <ArgumentException>(
         () => _whistleOptionsValidator.Validate(WhistleOptionsGenerator.Default().WithEmptyExecutableName()));
 }