public void ThisTestShouldFail() { Func <RiakResult> alwaysFail = () => RiakResult.FromError(ResultCode.InvalidRequest, "Nope.", true); Func <RiakResult> alwaysThrow = () => { throw new ApplicationException("Whoopsie"); }; var failResult = alwaysFail.WaitUntil(2); alwaysThrow.WaitUntil(2); failResult.IsSuccess.ShouldBeFalse(); }
public RiakResult <IEnumerable <TResult> > UseDelayedConnection <TResult>(Func <IRiakConnection, Action, RiakResult <IEnumerable <TResult> > > useFun) where TResult : RiakResult { if (disposing) { return(RiakResult <IEnumerable <TResult> > .FromError(ResultCode.ShuttingDown, "Connection is shutting down", true)); } var response = connections.DelayedConsume(useFun); if (response.Item1) { return(response.Item2); } return(RiakResult <IEnumerable <TResult> > .FromError(ResultCode.NoConnections, "Unable to acquire connection", true)); }