public void Should_Add_Mandatory_Arguments() { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); // When var result = fixture.Run(); // Then Assert.Equal("nuget disable source \"name\"", result.Args); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsCakeException(result, ".NET CLI: Process returned an error (exit code 1)."); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); fixture.GivenProcessCannotStart(); // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsCakeException(result, ".NET CLI: Process was not started."); }
public void Should_Throw_If_Settings_Are_Null() { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); fixture.Settings = null; // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsArgumentNullException(result, "settings"); }
public void Should_Throw_If_Name_Is_Null_Or_WhiteSpace(string name) { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); fixture.Name = name; // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsArgumentException(result, "name", "Value cannot be null or whitespace."); }
public void Should_Add_Host_Arguments() { // Given var fixture = new DotNetCoreNuGetDisableSourceFixture(); fixture.Settings = new DotNetCoreNuGetSourceSettings { DiagnosticOutput = true }; // When var result = fixture.Run(); // Then Assert.Equal("--diagnostics nuget disable source \"name\"", result.Args); }