public async Task Errored_IDomainResultOfT_Task_Converts_To_IDomainResultOfV_Task() { var domainResult = DomainResult.FailedTask <int>("Bla"); var domainResultOfT = await domainResult.To <int, char>(); Assert.False(domainResultOfT.IsSuccess); Assert.Equal(default(char), domainResultOfT.Value); Assert.Equal("Bla", domainResultOfT.Errors.Single()); }
public Task <IDomainResult <int> > GetFailedWithValidationMessagesWhenExpectedNumberTask() => DomainResult.FailedTask <int>(new[] { new ValidationResult("Validation message1", new[] { "fieldName1" }), new ValidationResult("Validation message2", new[] { "fieldName2" }) });
public Task <IDomainResult <int> > GetFailedWithMessageWhenExpectedNumberTask() => DomainResult.FailedTask <int>("Ah, error");
public Task <IDomainResult <int> > GetFailedWithMessagesWhenExpectedNumberTask() => DomainResult.FailedTask <int>(new[] { "Ah, error", "Terrible error" });
public Task <IDomainResult <int> > GetFailedWithNoMessageWhenExpectedNumberTask() => DomainResult.FailedTask <int>();
public Task <IDomainResult> GetFailedWithValidationMessagesTask() => DomainResult.FailedTask(new[] { new ValidationResult("Validation message1", new[] { "fieldName1" }), new ValidationResult("Validation message2", new[] { "fieldName2" }) });
public Task <IDomainResult> GetFailedWithMessagesTask() => DomainResult.FailedTask(new[] { "Ah, error", "Terrible error" });
public Task <IDomainResult> GetFailedWithMessageTask() => DomainResult.FailedTask("Ah, error");
public Task <IDomainResult> GetFailedWithNoMessageTask() => DomainResult.FailedTask();