Skip to content

Commit

Permalink
use default literal (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Jan 13, 2023
1 parent 58a3cc4 commit 19adf9f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public async Task Double_generic_SerializingCacheProvider_should_not_deserialize

cacheHit.Should().BeFalse();
deserializeInvoked.Should().BeFalse();
fromCache.Should().Be(default(ResultPrimitive));
fromCache.Should().Be(default);
}

[Fact]
Expand Down Expand Up @@ -437,7 +437,7 @@ public async Task Double_generic_SerializingCacheProvider_from_extension_syntax_

cacheHit.Should().BeFalse();
deserializeInvoked.Should().BeFalse();
fromCache.Should().Be(default(ResultPrimitive));
fromCache.Should().Be(default);
}

#endregion
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public void Double_generic_SerializingCacheProvider_should_not_deserialize_on_ge

cacheHit.Should().BeFalse();
deserializeInvoked.Should().BeFalse();
fromCache.Should().Be(default(ResultPrimitive));
fromCache.Should().Be(default);
}

[Fact]
Expand Down Expand Up @@ -439,7 +439,7 @@ public void Double_generic_SerializingCacheProvider_from_extension_syntax_should

cacheHit.Should().BeFalse();
deserializeInvoked.Should().BeFalse();
fromCache.Should().Be(default(ResultPrimitive));
fromCache.Should().Be(default);
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ public void Should_initialise_LastHandledResult_and_LastResult_to_default_on_cre
.HandleResult(ResultPrimitive.Fault)
.CircuitBreakerAsync(2, TimeSpan.FromMinutes(1));

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down Expand Up @@ -1366,7 +1366,7 @@ public async Task Should_set_LastHandledResult_to_default_on_circuit_reset()

breaker.Reset();

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public void Should_initialise_LastHandledResult_and_LastResult_to_default_on_cre
.OrResult(ResultPrimitive.Fault)
.CircuitBreaker(2, TimeSpan.FromMinutes(1));

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down Expand Up @@ -514,7 +514,7 @@ public void Should_set_LastException_on_exception_even_when_not_breaking()

breaker.CircuitState.Should().Be(CircuitState.Closed);

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeOfType<DivideByZeroException>();
}

Expand Down Expand Up @@ -554,7 +554,7 @@ public void Should_set_LastException_to_last_exception_when_breaking()

breaker.CircuitState.Should().Be(CircuitState.Open);

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeOfType<DivideByZeroException>();
}

Expand All @@ -579,7 +579,7 @@ public void Should_set_LastHandledResult_and_LastException_to_default_on_circuit

breaker.Reset();

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Specs/CircuitBreaker/CircuitBreakerTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ public void Should_initialise_LastHandledResult_and_LastResult_to_default_on_cre
.HandleResult(ResultPrimitive.Fault)
.CircuitBreaker(2, TimeSpan.FromMinutes(1));

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down Expand Up @@ -1355,7 +1355,7 @@ public void Should_set_LastHandledResult_to_default_on_circuit_reset()

breaker.Reset();

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
breaker.LastException.Should().BeNull();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public void Should_be_able_to_use_LastHandledResult_via_interface()
.HandleResult(ResultPrimitive.Fault)
.CircuitBreaker(2, TimeSpan.FromMinutes(1));

breaker.LastHandledResult.Should().Be(default(ResultPrimitive));
breaker.LastHandledResult.Should().Be(default);
}
}
2 changes: 1 addition & 1 deletion src/Polly.Specs/Wrap/PolicyWrapSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ public void Outermost_generic_policy_not_handling_result_even_if_inner_policies_
PolicyResult<ResultPrimitive> executeAndCaptureResultOnPolicyWrap = wrap.ExecuteAndCapture(() => ResultPrimitive.FaultAgain);

executeAndCaptureResultOnPolicyWrap.Outcome.Should().Be(OutcomeType.Successful);
executeAndCaptureResultOnPolicyWrap.FinalHandledResult.Should().Be(default(ResultPrimitive));
executeAndCaptureResultOnPolicyWrap.FinalHandledResult.Should().Be(default);
executeAndCaptureResultOnPolicyWrap.FaultType.Should().BeNull();
executeAndCaptureResultOnPolicyWrap.FinalException.Should().BeNull();
executeAndCaptureResultOnPolicyWrap.ExceptionType.Should().BeNull();
Expand Down
2 changes: 1 addition & 1 deletion src/Polly.Specs/Wrap/PolicyWrapSpecsAsync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ public async Task Outermost_generic_policy_not_handling_result_even_if_inner_pol
PolicyResult<ResultPrimitive> executeAndCaptureResultOnPolicyWrap = await wrap.ExecuteAndCaptureAsync(() => Task.FromResult(ResultPrimitive.FaultAgain));

executeAndCaptureResultOnPolicyWrap.Outcome.Should().Be(OutcomeType.Successful);
executeAndCaptureResultOnPolicyWrap.FinalHandledResult.Should().Be(default(ResultPrimitive));
executeAndCaptureResultOnPolicyWrap.FinalHandledResult.Should().Be(default);
executeAndCaptureResultOnPolicyWrap.FaultType.Should().BeNull();
executeAndCaptureResultOnPolicyWrap.FinalException.Should().BeNull();
executeAndCaptureResultOnPolicyWrap.ExceptionType.Should().BeNull();
Expand Down

0 comments on commit 19adf9f

Please sign in to comment.