public void Should_Add_Mandatory_Arguments()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            // When
            var result = fixture.Run();

            // Then
            Assert.Equal("ef database drop", result.Args);
        }
        public void Should_Add_Additional_Settings()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Settings.Context = "CakeContext";
            fixture.Settings.Force   = true;
            // When
            var result = fixture.Run();

            // Then
            Assert.Equal("ef database drop --context \"CakeContext\" --force", result.Args);
        }
        public void Should_Add_Path_Arguments()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Project   = "./tools/tool/";
            fixture.Arguments = "--args=\"value\"";
            // When
            var result = fixture.Run();

            // Then
            Assert.Equal("ef database drop --args=\"value\"", result.Args);
            Assert.Equal("/Working/tools/tool", result.Process.WorkingDirectory.FullPath);
        }
        public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Project = "./src/";
            fixture.GivenProcessExitsWithCode(1);

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

            // Then
            AssertExtensions.IsCakeException(result, ".NET Core CLI: Process returned an error (exit code 1).");
        }
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Project = "./src/";
            fixture.GivenProcessCannotStart();

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

            // Then
            AssertExtensions.IsCakeException(result, ".NET Core CLI: Process was not started.");
        }
        public void Should_Throw_If_Settings_Are_Null()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Project  = "./src/";
            fixture.Settings = null;
            fixture.GivenDefaultToolDoNotExist();

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

            // Then
            AssertExtensions.IsArgumentNullException(result, "settings");
        }
        public void Should_Add_Additional_Settings()
        {
            // Given
            var fixture = new DotNetCoreEfDatabaseDropperFixture();

            fixture.Settings.Context       = "CakeContext";
            fixture.Settings.Force         = true;
            fixture.Settings.Configuration = "release";
            fixture.Settings.MsBuildProjectExtensionsPath = "test-obj";
            fixture.Settings.Help           = true;
            fixture.Settings.Framework      = "netcoreapp2.0";
            fixture.Settings.Environment    = "Development";
            fixture.Settings.StartupProject = "..\\src\\test.csproj";
            fixture.Settings.Project        = "..\\src\\runner.csproj";

            // When
            var result = fixture.Run();

            // Then
            Assert.Equal("ef database drop --help --environment \"Development\" --startup-project \"..\\src\\test.csproj\" --project \"..\\src\\runner.csproj\" --configuration \"release\" --framework \"netcoreapp2.0\" --msbuildprojectextensionspath \"test-obj\" --context \"CakeContext\" --force", result.Args);
        }