Skip to content

Commit

Permalink
fixup: more awaits in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert committed Jan 19, 2024
1 parent e9bece4 commit d34331a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/OpenFeature.Tests/ProviderRepositoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ namespace OpenFeature.Tests
public class ProviderRepositoryTests
{
[Fact]
public void Default_Provider_Is_Set_Without_Await()
public async void Default_Provider_Is_Set_Without_Await()
{
var repository = new ProviderRepository();
var provider = new NoOpFeatureProvider();
var context = new EvaluationContextBuilder().Build();
repository.SetProvider(provider, context);
await repository.SetProvider(provider, context);
Assert.Equal(provider, repository.GetProvider());
}

[Fact]
public void AfterSet_Is_Invoked_For_Setting_Default_Provider()
public async void AfterSet_Is_Invoked_For_Setting_Default_Provider()
{
var repository = new ProviderRepository();
var provider = new NoOpFeatureProvider();
var context = new EvaluationContextBuilder().Build();
var callCount = 0;
// The setting of the provider is synchronous, so the afterSet should be as well.
repository.SetProvider(provider, context, afterSet: (theProvider) =>
await repository.SetProvider(provider, context, afterSet: (theProvider) =>
{
callCount++;
Assert.Equal(provider, theProvider);
Expand Down Expand Up @@ -182,24 +182,24 @@ await repository.SetProvider(provider2, context, afterError: (provider, ex) =>
}

[Fact]
public void Named_Provider_Provider_Is_Set_Without_Await()
public async void Named_Provider_Provider_Is_Set_Without_Await()
{
var repository = new ProviderRepository();
var provider = new NoOpFeatureProvider();
var context = new EvaluationContextBuilder().Build();
repository.SetProvider("the-name", provider, context);
await repository.SetProvider("the-name", provider, context);
Assert.Equal(provider, repository.GetProvider("the-name"));
}

[Fact]
public void AfterSet_Is_Invoked_For_Setting_Named_Provider()
public async void AfterSet_Is_Invoked_For_Setting_Named_Provider()
{
var repository = new ProviderRepository();
var provider = new NoOpFeatureProvider();
var context = new EvaluationContextBuilder().Build();
var callCount = 0;
// The setting of the provider is synchronous, so the afterSet should be as well.
repository.SetProvider("the-name", provider, context, afterSet: (theProvider) =>
await repository.SetProvider("the-name", provider, context, afterSet: (theProvider) =>
{
callCount++;
Assert.Equal(provider, theProvider);
Expand Down

0 comments on commit d34331a

Please sign in to comment.