A dotnet testing library, allowing you to test code that uses Futurum.Core. It contains a comprehensive set of assertions for testing Futurum.Core types.
Checks that the result is a success.
result.ShouldBeSuccess();
Checks that the result is a success and that the value is equal to the expected value.
result.ShouldBeSuccessWithValue(expectedValue);
Checks that the result is a success and that the value is equivalent to the expected value.
result.ShouldBeSuccessWithValueEquivalentTo(equivalentValue);
Checks that the result is a success and that the value is equivalent to the expected value.
result.ShouldBeSuccessWithValueEquivalentToAsync(numbers);
NOTE This method works with IAsyncEnumerable<T>.
Checks that the result is a success and that the value passes the assertions specified.
result.ShouldBeSuccessWithValueAssertion(x => x.Should().Be(expectedValue));
Checks that the result is a failure.
result.ShouldBeFailure();
Checks that the result is a failure and that the error is equal to the expected error.
result.ShouldBeFailureWithError(expectedErrorMessage);
Checks that the result is a failure and that the error is equal to the expected error.
result.ShouldBeFailureWithErrorSafe(expectedErrorMessage);
NOTE This will call ToErrorStringSafe on the error.
Checks that the result is a failure and that the error contains the expected error.
result.ShouldBeFailureWithErrorContaining(expectedErrorMessage);
Checks that the result is a failure and that the error contains the expected error.
result.ShouldBeFailureWithErrorContaining(expectedErrorMessage);
NOTE This will call ToErrorStringSafe on the error.
Check that the option has a value.
option.ShouldBeHasValue();
Check that the option has a value and that the value is equal to the expected value.
option.ShouldBeHasValueWithValue(expectedValue);
Check that the option has a value and that the value is equivalent to the expected value.
option.ShouldBeHasValueWithValueEquivalentTo(equivalentValue);
Check that the option has a value and that the value passes the assertions specified.
option.ShouldBeHasValueWithValueAssertion(x => x.Should().Be(expectedValue));
Check that the option has no value.
option.ShouldBeHasNoValue();