public async Task Successful_IDomainResultOfT_Task_Converts_To_IDomainResultOfV_Task() { var domainResult = DomainResult.SuccessTask(10); var domainResultOfT = await domainResult.To <int, char>(); Assert.True(domainResultOfT.IsSuccess); Assert.Equal(default(char), domainResultOfT.Value); }
public async Task Successful_IDomainResult_Task_Converts_To_IDomainResultOfT_Task() { var domainResult = DomainResult.SuccessTask(); var domainResultOfT = await domainResult.To <int>(); Assert.True(domainResultOfT.IsSuccess); Assert.Equal(0, domainResultOfT.Value); }
private static object[] GetTestCase <T>(T domainValue, bool genericClass, bool wrapInTask = false) => wrapInTask ? new object[] { genericClass?DomainResult <T> .SuccessTask(domainValue) : DomainResult.SuccessTask(domainValue) } : new object[] { genericClass?DomainResult <T> .Success(domainValue) : DomainResult.Success(domainValue) };
public async Task DomainResult_Task_Converted_To_NoContent() { // GIVEN a successful domain result var domainRes = DomainResult.SuccessTask(); // WHEN convert it to ActionResult var actionRes = await domainRes.ToActionResult(); // THEN the response type is correct Assert.IsType <NoContentResult>(actionRes); }