public async Task BindAsync_onAsyncValueTask_givenSuccessValueTask_ReturnsSuccessValueTask() { var success = new ValueTask <IResult <int> >(new TaskFactory().StartNew(() => ResultFactory.CreateSuccess(5))); var result = await success.BindAsync(Add5); result.ShouldBeSuccess(); result.Payload().ShouldBe(10); }
public async Task BindAsync_onValueTask_givenSuccessTask_ReturnsSuccessValueTask() { var success = new ValueTask <IResult <int> >(ResultFactory.CreateSuccess(5)); var result = await success.BindAsync(Add5Async); result.ShouldBeSuccess(); result.Payload().ShouldBe(10); }
public async Task BindAsync_onValueTask_givenFailureSync_ReturnsSuccessValueTask() { var success = new ValueTask <IResult <int> >(5.AsResult()); var result = await success.BindAsync(FailSync); result.ShouldBeFailure(); result.Error().Message.ShouldBe("fail"); }