Skip to content
Prev Previous commit
Next Next commit
Properly await Assert.ThrowsAsync() calls
Pointed out by Visual Studio.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Sep 30, 2024
commit 6f13e76a2730162dbb2cb33502f979f02aa75e25
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ namespace GitCredentialManager.Tests.Authentication
public class BasicAuthenticationTests
{
[Fact]
public void BasicAuthentication_GetCredentials_NullResource_ThrowsException()
public async Task BasicAuthentication_GetCredentials_NullResource_ThrowsException()
{
var context = new TestCommandContext();
var basicAuth = new BasicAuthentication(context);

Assert.ThrowsAsync<ArgumentNullException>(() => basicAuth.GetCredentialsAsync(null));
await Assert.ThrowsAsync<ArgumentNullException>(() => basicAuth.GetCredentialsAsync(null));
}

[Fact]
Expand Down Expand Up @@ -58,7 +58,7 @@ public async Task BasicAuthentication_GetCredentials_NonDesktopSession_Resource_
}

[Fact]
public void BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPrompts_ThrowsException()
public async Task BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPrompts_ThrowsException()
{
const string testResource = "https://example.com";

Expand All @@ -70,7 +70,7 @@ public void BasicAuthentication_GetCredentials_NonDesktopSession_NoTerminalPromp

var basicAuth = new BasicAuthentication(context);

Assert.ThrowsAsync<InvalidOperationException>(() => basicAuth.GetCredentialsAsync(testResource));
await Assert.ThrowsAsync<InvalidOperationException>(() => basicAuth.GetCredentialsAsync(testResource));
}

[Fact]
Expand Down
4 changes: 2 additions & 2 deletions src/shared/Core.Tests/HostProviderRegistryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public void HostProviderRegistry_Register_AutoAuthorityId_ThrowException()
}

[Fact]
public void HostProviderRegistry_GetProvider_NoProviders_ThrowException()
public async Task HostProviderRegistry_GetProvider_NoProviders_ThrowException()
{
var context = new TestCommandContext();
var registry = new HostProviderRegistry(context);
var input = new InputArguments(new Dictionary<string, string>());

Assert.ThrowsAsync<Exception>(() => registry.GetProviderAsync(input));
await Assert.ThrowsAsync<Exception>(() => registry.GetProviderAsync(input));
}

[Fact]
Expand Down