예제 #1
0
        /// <summary>
        /// Creates a copy of this command, setting the environment variables to the value configured by the specified delegate.
        /// </summary>
        public Command WithEnvironmentVariables(Action <EnvironmentVariablesBuilder> configure)
        {
            var builder = new EnvironmentVariablesBuilder();

            configure(builder);

            return(WithEnvironmentVariables(builder.Build()));
        }
예제 #2
0
        public void I_can_build_environment_variables_from_multiple_individual_variables()
        {
            // Arrange
            var builder = new EnvironmentVariablesBuilder();

            // Act
            var envVars = builder
                          .Set("foo", "bar")
                          .Set("lo", "dash")
                          .Build();

            // Assert
            envVars.Should().BeEquivalentTo(new Dictionary <string, string>
            {
                ["foo"] = "bar",
                ["lo"]  = "dash"
            });
        }
예제 #3
0
        public void Environment_variables_can_be_set_with_a_builder()
        {
            // Arrange
            var builder = new EnvironmentVariablesBuilder();

            // Act
            var envVars = builder
                          .Set("foo", "bar")
                          .Set("lo", "dash")
                          .Build();

            // Assert
            envVars.Should().BeEquivalentTo(new Dictionary <string, string>
            {
                ["foo"] = "bar",
                ["lo"]  = "dash"
            });
        }