public void BindIf_E_executes_func_conditionally_and_returns_new_result(bool isSuccess, bool condition, bool isSuccessAction) { UnitResult <E> result = UnitResult.SuccessIf(isSuccess, E.Value); UnitResult <E> returned = result.BindIf(condition, GetErrorAction(isSuccessAction)); actionExecuted.Should().Be(isSuccess && condition); returned.Should().Be(GetExpectedErrorResult(isSuccess, condition, isSuccessAction)); }
public async Task BindIf_AsyncLeft_computes_predicate_E_executes_func_conditionally_and_returns_new_result(bool isSuccess, bool condition, bool isSuccessAction) { UnitResult <E> result = UnitResult.SuccessIf(isSuccess, E.Value); UnitResult <E> returned = await result.BindIf(GetPredicate(condition), GetAsyncErrorAction(isSuccessAction)); predicateExecuted.Should().Be(isSuccess); actionExecuted.Should().Be(isSuccess && condition); returned.Should().Be(GetExpectedErrorResult(isSuccess, condition, isSuccessAction)); }