예제 #1
0
 private Task <Option <Waiter, Error> > CheckIfWaiterExists(Guid waiterId) =>
 _waiterRepository
 .Get(waiterId)
 .WithException(Error.NotFound($"No waiter with an id of {waiterId} was found."));
 private Task <Option <Waiter, Error> > WaiterShouldExist(Guid waiterId) =>
 _waiterRepository
 .Get(waiterId)
 .WithException(Error.NotFound($"No waiter with id {waiterId} was found."));
예제 #3
0
 private async Task <Option <Unit, Error> > WaiterShouldntExist(Guid waiterId) =>
 (await _waiterRepository.Get(waiterId))
 .SomeWhen(w => !w.HasValue, Error.Conflict($"Waiter {waiterId} already exists."))
 .Map(_ => Unit.Value);