Skip to content

Commit

Permalink
Modified unit test to throw mocked FliptExceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei de la Cruz <[email protected]>
  • Loading branch information
jeandreidc committed Oct 2, 2024
1 parent 563dd5f commit 29077ea
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async Task EvaluateBooleanAsync_GivenHttpRequestException_ShouldHandleHtt
var mockFliptClientWrapper = new Mock<IFliptClientWrapper>();
mockFliptClientWrapper.Setup(fcw =>
fcw.EvaluateBooleanAsync(It.IsAny<EvaluationRequest>()))
.ThrowsAsync(new HttpRequestException("", null, thrownStatusCode));
.ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null));

var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object);
var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("flagKey", fallbackValue);
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task EvaluateBooleanAsync_GivenNonExistentFlag_ShouldReturnDefaultV
{
var mockFliptClientWrapper = new Mock<IFliptClientWrapper>();
mockFliptClientWrapper.Setup(fcw => fcw.EvaluateBooleanAsync(It.IsAny<EvaluationRequest>()))
.ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound));
.ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null));

var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object);
var resolution = await fliptToOpenFeature.EvaluateBooleanAsync("show-feature", fallBackValue);
Expand All @@ -85,7 +85,7 @@ public async Task EvaluateAsync_GivenHttpRequestException_ShouldHandleHttpReques
var mockFliptClientWrapper = new Mock<IFliptClientWrapper>();
mockFliptClientWrapper.Setup(fcw =>
fcw.EvaluateVariantAsync(It.IsAny<EvaluationRequest>()))
.ThrowsAsync(new HttpRequestException("", null, thrownStatusCode));
.ThrowsAsync(new FliptException("", (int)thrownStatusCode, "", null, null));

var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object);
var resolution = await fliptToOpenFeature.EvaluateAsync("flagKey", fallbackValue);
Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task
}));
var mockFliptClientWrapper = new Mock<IFliptClientWrapper>();
mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny<EvaluationRequest>()))
.ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound));
.ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null));

var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object);
var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue);
Expand All @@ -188,7 +188,7 @@ public async Task
var fallbackValue = new Value("");
var mockFliptClientWrapper = new Mock<IFliptClientWrapper>();
mockFliptClientWrapper.Setup(fcw => fcw.EvaluateVariantAsync(It.IsAny<EvaluationRequest>()))
.ThrowsAsync(new HttpRequestException("", null, HttpStatusCode.NotFound));
.ThrowsAsync(new FliptException("", (int)HttpStatusCode.NotFound, "", null, null));

var fliptToOpenFeature = new FliptToOpenFeatureConverter(mockFliptClientWrapper.Object);
var resolution = await fliptToOpenFeature.EvaluateAsync("non-existent-flag", fallbackValue);
Expand Down

0 comments on commit 29077ea

Please sign in to comment.