Skip to content

Commit

Permalink
Clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patriksvensson committed Jul 12, 2024
1 parent 07d91f5 commit d3ec66e
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 74 deletions.
File renamed without changes.
16 changes: 0 additions & 16 deletions src/Cupboard.Tests/Fixtures/FakeProcessRunnerFixture.cs

This file was deleted.

19 changes: 0 additions & 19 deletions src/Cupboard.Tests/Fixtures/WindowsFact.cs

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public override void Execute(ManifestContext context)

public sealed class EnsureInstalled
{
[WindowsFact]
[Fact]
public void Should_Install_Package_If_Missing()
{
// Given
Expand All @@ -74,7 +74,7 @@ public void Should_Install_Package_If_Missing()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_If_Present()
{
// Given
Expand All @@ -92,7 +92,7 @@ public void Should_Not_Install_Package_If_Present()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] is already installed");
}

[WindowsFact]
[Fact]
public void Should_Install_Package_Version_If_Missing()
{
// Given
Expand All @@ -116,7 +116,7 @@ public void Should_Install_Package_Version_If_Missing()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Install_Package_If_Lower_Version()
{
// Given
Expand All @@ -140,7 +140,7 @@ public void Should_Install_Package_If_Lower_Version()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Install_Package_If_Lower_Version_With_No_NewLine()
{
// Given
Expand All @@ -164,7 +164,7 @@ public void Should_Install_Package_If_Lower_Version_With_No_NewLine()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_Of_Same_Version()
{
// Given
Expand All @@ -182,7 +182,7 @@ public void Should_Not_Install_Package_Of_Same_Version()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] is already installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_Of_Higher_Version()
{
// Given
Expand All @@ -200,7 +200,7 @@ public void Should_Not_Install_Package_Of_Higher_Version()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] is already installed");
}

[WindowsFact]
[Fact]
public void Should_Install_Package_If_Higher_Version_With_Allow_Downgrade()
{
// Given
Expand All @@ -224,7 +224,7 @@ public void Should_Install_Package_If_Higher_Version_With_Allow_Downgrade()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Install_Package_If_Lower_Version_With_Allow_Downgrade()
{
// Given
Expand All @@ -248,7 +248,7 @@ public void Should_Install_Package_If_Lower_Version_With_Allow_Downgrade()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_Of_Same_Version_With_Allow_Downgrade()
{
// Given
Expand All @@ -269,7 +269,7 @@ public void Should_Not_Install_Package_Of_Same_Version_With_Allow_Downgrade()

public sealed class EnsureUninstalled
{
[WindowsFact]
[Fact]
public void Should_Uninstall_Package_If_Present()
{
// Given
Expand All @@ -291,7 +291,7 @@ public void Should_Uninstall_Package_If_Present()
fixture.Logger.WasLogged("The Chocolatey package [yellow]vscode[/] was uninstalled");
}

[WindowsFact]
[Fact]
public void Should_Not_Uninstall_Package_If_Absent()
{
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override void Execute(ManifestContext context)
}
}

[WindowsFact]
[Fact]
public void Should_Run_Script()
{
// Given
Expand All @@ -62,7 +62,7 @@ public void Should_Run_Script()
fixture.Logger.WasLogged("Running PowerShell script [yellow]C:/lol.ps1[/]");
}

[WindowsFact]
[Fact]
public void Should_Run_Command()
{
// Given
Expand All @@ -80,7 +80,7 @@ public void Should_Run_Command()
fixture.Logger.WasLogged("Running PowerShell command: [yellow]Not really executed, but must be present[/]");
}

[WindowsFact]
[Fact]
public void Should_Skip_Running_Skip_If_Condition_Script_Does_Not_Have_Exit_Code_1()
{
// Given
Expand All @@ -101,7 +101,7 @@ public void Should_Skip_Running_Skip_If_Condition_Script_Does_Not_Have_Exit_Code
fixture.Logger.WasLogged("Skipping PowerShell script since condition did not evaluate to 0 (zero)");
}

[WindowsFact]
[Fact]
public void Should_Return_Error_If_Script_Does_Not_Exist()
{
// Given
Expand All @@ -117,7 +117,7 @@ public void Should_Return_Error_If_Script_Does_Not_Exist()
fixture.Logger.WasLogged("PowerShell script path does not exist");
}

[WindowsFact]
[Fact]
public void Should_Run_Script_Using_PowerShell_Core_On_Windows_If_Specified()
{
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class Install : Manifest
{
public override void Execute(ManifestContext context)
{
context.Resource<VSCodeExtension>(ExtensionName)
context.Resource<VsCodeExtension>(ExtensionName)
.Ensure(PackageState.Installed);
}
}
Expand All @@ -21,7 +21,7 @@ public sealed class Uninstall : Manifest
{
public override void Execute(ManifestContext context)
{
context.Resource<VSCodeExtension>(ExtensionName)
context.Resource<VsCodeExtension>(ExtensionName)
.Ensure(PackageState.Uninstalled);
}
}
Expand All @@ -31,7 +31,7 @@ public sealed class Windows
{
public sealed class EnsureInstalled
{
[WindowsFact]
[Fact]
public void Should_Install_Package_If_Missing()
{
// Given
Expand All @@ -50,12 +50,12 @@ public void Should_Install_Package_If_Missing()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
fixture.Logger.WasLogged($"Installing VSCode extension [yellow]{ExtensionName}[/]");
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_If_Present()
{
// Given
Expand All @@ -69,14 +69,14 @@ public void Should_Not_Install_Package_If_Present()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] is already installed");
}
}

public sealed class EnsureUninstalled
{
[WindowsFact]
[Fact]
public void Should_Uninstall_Package_If_Present()
{
// Given
Expand All @@ -94,12 +94,12 @@ public void Should_Uninstall_Package_If_Present()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
fixture.Logger.WasLogged($"Uninstalling VSCode extension [yellow]{ExtensionName}[/]");
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] was uninstalled");
}

[WindowsFact]
[Fact]
public void Should_Not_Uninstall_Package_If_Absent()
{
// Given
Expand All @@ -113,7 +113,7 @@ public void Should_Not_Uninstall_Package_If_Absent()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] is already uninstalled");
}
}
Expand All @@ -123,7 +123,7 @@ public sealed class Linux
{
public sealed class EnsureInstalled
{
[WindowsFact]
[Fact]
public void Should_Install_Package_If_Missing()
{
// Given
Expand All @@ -142,12 +142,12 @@ public void Should_Install_Package_If_Missing()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
fixture.Logger.WasLogged($"Installing VSCode extension [yellow]{ExtensionName}[/]");
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_If_Present()
{
// Given
Expand All @@ -161,14 +161,14 @@ public void Should_Not_Install_Package_If_Present()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] is already installed");
}
}

public sealed class EnsureUninstalled
{
[WindowsFact]
[Fact]
public void Should_Uninstall_Package_If_Present()
{
// Given
Expand All @@ -186,12 +186,12 @@ public void Should_Uninstall_Package_If_Present()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Changed);
fixture.Logger.WasLogged($"Uninstalling VSCode extension [yellow]{ExtensionName}[/]");
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] was uninstalled");
}

[WindowsFact]
[Fact]
public void Should_Not_Uninstall_Package_If_Absent()
{
// Given
Expand All @@ -205,7 +205,7 @@ public void Should_Not_Uninstall_Package_If_Absent()
var result = fixture.Run("-y");

// Then
result.Report.GetState<VSCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
result.Report.GetState<VsCodeExtension>(ExtensionName).ShouldBe(ResourceState.Unchanged);
fixture.Logger.WasLogged($"The VSCode extension [yellow]{ExtensionName}[/] is already uninstalled");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public override void Execute(ManifestContext context)

public sealed class EnsureInstalled
{
[WindowsFact]
[Fact]
public void Should_Install_Package_If_Missing()
{
// Given
Expand All @@ -50,7 +50,7 @@ public void Should_Install_Package_If_Missing()
fixture.Logger.WasLogged("The Winget package [yellow]GitHub.cli[/] was installed");
}

[WindowsFact]
[Fact]
public void Should_Not_Install_Package_If_Present_lol()
{
// Given
Expand All @@ -71,7 +71,7 @@ public void Should_Not_Install_Package_If_Present_lol()

public sealed class EnsureUninstalled
{
[WindowsFact]
[Fact]
public void Should_Uninstall_Package_If_Present()
{
// Given
Expand All @@ -93,7 +93,7 @@ public void Should_Uninstall_Package_If_Present()
fixture.Logger.WasLogged("The Winget package [yellow]GitHub.cli[/] was uninstalled");
}

[WindowsFact]
[Fact]
public void Should_Not_Uninstall_Package_If_Absent()
{
// Given
Expand Down

0 comments on commit d3ec66e

Please sign in to comment.