コード例 #1
0
            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);
            }
コード例 #2
0
            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);
            }
コード例 #3
0
            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");
            }