Skip to content

Commit

Permalink
fixup: review
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <[email protected]>
  • Loading branch information
toddbaert committed Jan 18, 2024
1 parent e4c0ed9 commit 1ae7b1c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/OpenFeature/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private Api() { }
public void SetProvider(FeatureProvider featureProvider)
{
this.EventExecutor.RegisterDefaultFeatureProvider(featureProvider);
this._repository.SetProvider(featureProvider, this.GetContext()).ConfigureAwait(false);
_ = this._repository.SetProvider(featureProvider, this.GetContext());
}

/// <summary>
Expand All @@ -71,7 +71,7 @@ public async Task SetProviderAsync(FeatureProvider featureProvider)
public void SetProvider(string clientName, FeatureProvider featureProvider)
{
this.EventExecutor.RegisterClientFeatureProvider(clientName, featureProvider);
this._repository.SetProvider(clientName, featureProvider, this.GetContext()).ConfigureAwait(false);
_ = this._repository.SetProvider(clientName, featureProvider, this.GetContext());
}

Check warning on line 75 in src/OpenFeature/Api.cs

View check run for this annotation

Codecov / codecov/patch

src/OpenFeature/Api.cs#L72-L75

Added lines #L72 - L75 were not covered by tests

/// <summary>
Expand Down
28 changes: 14 additions & 14 deletions test/OpenFeature.Tests/OpenFeatureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ public async Task OpenFeature_Should_Support_Shutdown()

[Fact]
[Specification("1.1.3", "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.")]
public void OpenFeature_Should_Not_Change_Named_Providers_When_Setting_Default_Provider()
public async void OpenFeature_Should_Not_Change_Named_Providers_When_Setting_Default_Provider()
{
var openFeature = Api.Instance;

openFeature.SetProviderAsync(new NoOpFeatureProvider());
openFeature.SetProviderAsync(TestProvider.DefaultName, new TestProvider());
await openFeature.SetProviderAsync(new NoOpFeatureProvider()).ConfigureAwait(false);
await openFeature.SetProviderAsync(TestProvider.DefaultName, new TestProvider()).ConfigureAwait(false);

var defaultClient = openFeature.GetProviderMetadata();
var namedClient = openFeature.GetProviderMetadata(TestProvider.DefaultName);
Expand All @@ -115,11 +115,11 @@ public void OpenFeature_Should_Not_Change_Named_Providers_When_Setting_Default_P

[Fact]
[Specification("1.1.3", "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.")]
public void OpenFeature_Should_Set_Default_Provide_When_No_Name_Provided()
public async void OpenFeature_Should_Set_Default_Provide_When_No_Name_Provided()
{
var openFeature = Api.Instance;

openFeature.SetProviderAsync(new TestProvider());
await openFeature.SetProviderAsync(new TestProvider()).ConfigureAwait(false);

var defaultClient = openFeature.GetProviderMetadata();

Expand All @@ -128,26 +128,26 @@ public void OpenFeature_Should_Set_Default_Provide_When_No_Name_Provided()

[Fact]
[Specification("1.1.3", "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.")]
public void OpenFeature_Should_Assign_Provider_To_Existing_Client()
public async void OpenFeature_Should_Assign_Provider_To_Existing_Client()
{
const string name = "new-client";
var openFeature = Api.Instance;

openFeature.SetProviderAsync(name, new TestProvider());
openFeature.SetProviderAsync(name, new NoOpFeatureProvider());
await openFeature.SetProviderAsync(name, new TestProvider()).ConfigureAwait(true);
await openFeature.SetProviderAsync(name, new NoOpFeatureProvider()).ConfigureAwait(true);

openFeature.GetProviderMetadata(name).Name.Should().Be(NoOpProvider.NoOpProviderName);
}

[Fact]
[Specification("1.1.3", "The `API` MUST provide a function to bind a given `provider` to one or more client `name`s. If the client-name already has a bound provider, it is overwritten with the new mapping.")]
public void OpenFeature_Should_Allow_Multiple_Client_Names_Of_Same_Instance()
public async void OpenFeature_Should_Allow_Multiple_Client_Names_Of_Same_Instance()
{
var openFeature = Api.Instance;
var provider = new TestProvider();

openFeature.SetProviderAsync("a", provider);
openFeature.SetProviderAsync("b", provider);
await openFeature.SetProviderAsync("a", provider).ConfigureAwait(true);
await openFeature.SetProviderAsync("b", provider).ConfigureAwait(true);

var clientA = openFeature.GetProvider("a");
var clientB = openFeature.GetProvider("b");
Expand Down Expand Up @@ -234,12 +234,12 @@ public void Should_Always_Have_Provider()
}

[Fact]
public void OpenFeature_Should_Allow_Multiple_Client_Mapping()
public async void OpenFeature_Should_Allow_Multiple_Client_Mapping()
{
var openFeature = Api.Instance;

openFeature.SetProviderAsync("client1", new TestProvider());
openFeature.SetProviderAsync("client2", new NoOpFeatureProvider());
await openFeature.SetProviderAsync("client1", new TestProvider()).ConfigureAwait(true);
await openFeature.SetProviderAsync("client2", new NoOpFeatureProvider()).ConfigureAwait(true);

var client1 = openFeature.GetClient("client1");
var client2 = openFeature.GetClient("client2");
Expand Down

0 comments on commit 1ae7b1c

Please sign in to comment.