public void AddErrors_AsParams_AddsMultipleErrors() { //Arrange var sut = new OperationResult("three"); // Act sut.AddErrors("one", "two"); // Assert sut.Errors.Should().Contain("one", "two", "three") .And.HaveCount(3); }
public void AddErrors_Adds_MultipleErrors() { //Arrange var sut = new OperationResult("three"); // Act sut.AddErrors(new List <string>() { "one", "two" }); // Assert sut.Errors.Should().Contain("one", "two", "three") .And.HaveCount(3); }
public async Task <OperationResult <Ad> > GetByIdAsync(Guid id) { var result = new OperationResult <Ad>(); var ad = await _adService.GetByIdAsync(id, CancellationToken); if (ad.Sucess) { result.SetValue(ad.Value); } else { result.AddErrors(ad.Errors); } return(result); }
public OperationResult <Ad> GetById(Guid id) { var result = new OperationResult <Ad>(); var ad = _adService.GetById(id); if (ad.Sucess) { result.SetValue(ad.Value); } else { result.AddErrors(ad.Errors); } return(result); }
public async Task <OperationResult <Image> > GetByIdAsync(Guid id) { var result = new OperationResult <Image>(); var ad = await _service.GetByIdAsync(id); if (ad.Sucess) { result.SetValue(ad.Value); } else { result.AddErrors(ad.Errors); } return(result); }
public async Task <OperationResult <Account> > GetByIdAsync(Guid accountId) { var result = new OperationResult <Account>(); var account = await _userManager.GetByIdAsync(accountId); if (account.Sucess) { result.SetValue(account.Value); } else { result.AddErrors(account.Errors); } return(result); }