public void Should_set_destroy_parameter()
            {
                var fixture = new TerraformDestroyFixture();

                var result = fixture.Run();

                Assert.Contains("destroy", result.Args);
            }
            public void Should_find_terraform_if_tool_path_not_provided()
            {
                var fixture = new TerraformDestroyFixture();

                var result = fixture.Run();

                Assert.Equal("/Working/tools/terraform.exe", result.Path.FullPath);
            }
            public void Should_throw_if_process_has_a_non_zero_exit_code()
            {
                var fixture = new TerraformDestroyFixture();

                fixture.GivenProcessExitsWithCode(1);

                var result = Record.Exception(() => fixture.Run());

                Assert.IsType <CakeException>(result);
                Assert.Equal("Terraform: Process returned an error (exit code 1).", result.Message);
            }
            public void Should_throw_if_terraform_runner_was_not_found()
            {
                var fixture = new TerraformDestroyFixture();

                fixture.GivenDefaultToolDoNotExist();

                var result = Record.Exception(() => fixture.Run());

                Assert.IsType <CakeException>(result);
                Assert.Equal("Terraform: Could not locate executable.", result.Message);
            }
            public void Should_use_terraform_from_tool_path_if_provided(string toolPath, string expected)
            {
                var fixture = new TerraformDestroyFixture {
                    Settings = { ToolPath = toolPath }
                };

                fixture.GivenSettingsToolPathExist();

                var result = fixture.Run();

                Assert.Equal(expected, result.Path.FullPath);
            }
            public void Should_set_force_flag_when_set_to_true()
            {
                var fixture = new TerraformDestroyFixture
                {
                    Settings = new TerraformDestroySettings
                    {
                        Force = true
                    }
                };
                var result = fixture.Run();

                Assert.Contains("-force", result.Args);
            }
            public void Should_set_input_variables()
            {
                var fixture = new TerraformDestroyFixture
                {
                    Settings = new TerraformDestroySettings
                    {
                        InputVariables = new Dictionary <string, string>
                        {
                            { "access_key", "foo" },
                            { "secret_key", "bar" }
                        }
                    }
                };
                var result = fixture.Run();

                Assert.Contains("-var \"access_key=foo\" -var \"secret_key=bar\"", result.Args);
            }