Example #1
0
        public async Task ErrorAsync_When_PassingResultIntoValueTaskAsyncMethod_Then_ResultShouldBeValueTaskOfResult()
        {
            const double ExpectedError = 65d;

            Result.IfError <double> result = await ComputeAsync(() => Result.ErrorAsync(65d)).ConfigureAwait(false);

            result.IsSuccess.Should().BeFalse();
            result.Error.Should().Be(ExpectedError);
        }
Example #2
0
        public async Task ImplicitCast_WhenCastingToIfError_Then_ErrorShouldBeExpectedError()
        {
            const string ExpectedError = "Failed";

            Result.IfError <string> result = await ComputeAsync(() => Result.ErrorAsync(ExpectedError)).ConfigureAwait(false);

            result.IsSuccess.Should().BeFalse();
            result.Error.Should().Be(ExpectedError);
        }
Example #3
0
        public void ImplicitCast_WhenCastingToIfError_Then_ErrorShouldBeExpectedError()
        {
            const string ExpectedError = "Failed";

            Result.IfError <string> result = Result.Error(ExpectedError);

            result.IsSuccess.Should().BeFalse();
            result.Error.Should().Be(ExpectedError);
        }