-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds edge case for EvaluateAsync call that doesn't use context from F…
…eatureManager (#246) (#247) * Adds edge case for EvaluateAsync call that doesn't use context from FeatureManager
- Loading branch information
1 parent
1622bca
commit 3b0c61b
Showing
8 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Options; | ||
using Microsoft.FeatureManagement; | ||
using Microsoft.FeatureManagement.FeatureFilters; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Tests.FeatureManagement | ||
{ | ||
[FilterAlias(Alias)] | ||
class CustomTargetingFilter : IFeatureFilter | ||
{ | ||
private const string Alias = "CustomTargetingFilter"; | ||
private readonly ContextualTargetingFilter _contextualFilter; | ||
|
||
public CustomTargetingFilter(IOptions<TargetingEvaluationOptions> options, ILoggerFactory loggerFactory) | ||
{ | ||
_contextualFilter = new ContextualTargetingFilter(options, loggerFactory); | ||
} | ||
|
||
public Func<FeatureFilterEvaluationContext, Task<bool>> Callback { get; set; } | ||
|
||
public Task<bool> EvaluateAsync(FeatureFilterEvaluationContext context) | ||
{ | ||
return _contextualFilter.EvaluateAsync(context, new TargetingContext(){ UserId = "Jeff" }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters