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);
        }
        internal SynchronizedStore(IRecord record, LocalItemStore localStore, RecordItemChangeTable changeTable)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            if (localStore == null)
            {
                throw new ArgumentNullException("itemStore");
            }
            if (changeTable == null)
            {
                throw new ArgumentNullException("changeTable");
            }

            //m_record = record;
            SectionsToFetch = ItemSectionType.Standard;

            m_localStore = localStore;
            m_remoteStore = new RemoteItemStore(record);
            m_changeManager = new RecordItemChangeManager(this, changeTable);
            m_itemLocks = new RecordItemLockTable();
        }
示例#3
0
        internal SynchronizedStore(IRecord record, LocalItemStore localStore, RecordItemChangeTable changeTable)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            if (localStore == null)
            {
                throw new ArgumentNullException("itemStore");
            }
            if (changeTable == null)
            {
                throw new ArgumentNullException("changeTable");
            }

            //m_record = record;
            SectionsToFetch = ItemSectionType.Standard;

            m_localStore    = localStore;
            m_remoteStore   = new RemoteItemStore(record);
            m_changeManager = new RecordItemChangeManager(this, changeTable);
            m_itemLocks     = new RecordItemLockTable();
        }
 public static TestRemoteStore CreateServerErrorProducer(IRemoteItemStore inner)
 {
     return(CreateServerErrorProducer(inner,
                                      new ServerErrorNumber[] { ServerErrorNumber.Failed, ServerErrorNumber.RequestTimedOut }));
 }
 public TestRemoteStore(IRemoteItemStore innerStore)
 {
     m_innerStore       = innerStore;
     m_errorProbability = 0.5;
     m_rand             = new Random();
 }
 public TestRemoteStore(IRemoteItemStore innerStore)
 {
     m_innerStore = innerStore;
     m_errorProbability = 0.5;
     m_rand = new Random();
 }
        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)
 {
     return CreateServerErrorProducer(inner, 
                                 new ServerErrorNumber[] {ServerErrorNumber.Failed, ServerErrorNumber.RequestTimedOut});
 }