public static TestRemoteStore CreateServerErrorProducer(IRemoteItemStore inner, IList <ServerErrorNumber> errors) { TestRemoteStore store = new TestRemoteStore(inner); Random rand = new Random(); store.ErrorThrower = delegate() { ServerErrorNumber error = 0; lock (rand) { error = errors[rand.Next(0, errors.Count - 1)]; } ServerStatusCode code = (ServerStatusCode)((uint)error - (uint)HResults.ServerErrorBase); throw new ServerException(code); }; return(store); }
public static TestRemoteStore CreateServerErrorProducer(IRemoteItemStore inner, IList<ServerErrorNumber> errors) { TestRemoteStore store = new TestRemoteStore(inner); Random rand = new Random(); store.ErrorThrower = delegate() { ServerErrorNumber error = 0; lock(rand) { error = errors[rand.Next(0, errors.Count - 1)]; } ServerStatusCode code = (ServerStatusCode)((uint)error - (uint)HResults.ServerErrorBase); throw new ServerException(code); }; return store; }