Skip to content

Commit

Permalink
Merge pull request #756 from cabinetoffice/tidying/auth-key-tests-con…
Browse files Browse the repository at this point in the history
…tinued

Add a missing await call to let the call finish before the test completes
  • Loading branch information
jakzal authored Oct 15, 2024
2 parents 418fe29 + 14137a6 commit 0e663d9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,17 @@ public async Task ItFindsSavedAuthenticationKeyByNameKeyAndOrganisationId()
}

[Fact]
public void ItRejectsTwoApiKeyWithTheSameName()
public async Task ItRejectsTwoApiKeyWithTheSameName()
{
using var repository = AuthenticationKeyRepository();
var organisation = GivenOrganisation();
var key = Guid.NewGuid().ToString();
var authenticationKey1 = GivenAuthenticationKey(name: "fts", key: key, organisation: organisation);
var authenticationKey2 = GivenAuthenticationKey(name: "fts", key: key, organisation: organisation);

repository.Save(authenticationKey1);
await repository.Save(authenticationKey1);

repository.Invoking(async r => await r.Save(authenticationKey2))
await repository.Invoking(async r => await r.Save(authenticationKey2))
.Should().ThrowAsync<IAuthenticationKeyRepository.AuthenticationKeyRepositoryException.DuplicateAuthenticationKeyNameException>()
.WithMessage($"Authentication Key with name `fts` already exists.");
}
Expand Down

0 comments on commit 0e663d9

Please sign in to comment.