示例#1
0
        public void SuccessfulRequestSetsInitializedToTrue()
        {
            AllData allData = MakeAllData();

            _mockFeatureRequestor.Setup(fr => fr.GetAllDataAsync()).ReturnsAsync(allData);
            using (PollingProcessor pp = new PollingProcessor(_config, _featureRequestor, _featureStore))
            {
                var initTask = ((IUpdateProcessor)pp).Start();
                initTask.Wait();
                Assert.True(((IUpdateProcessor)pp).Initialized());
            }
        }
示例#2
0
 private void VerifyRecoverableHttpError(int status)
 {
     _mockFeatureRequestor.Setup(fr => fr.GetAllDataAsync()).ThrowsAsync(
         new UnsuccessfulResponseException(status));
     using (PollingProcessor pp = new PollingProcessor(_config, _featureRequestor, _featureStore))
     {
         var  initTask  = ((IUpdateProcessor)pp).Start();
         bool completed = initTask.Wait(TimeSpan.FromMilliseconds(200));
         Assert.False(completed);
         Assert.False(((IUpdateProcessor)pp).Initialized());
     }
 }
示例#3
0
 public void ConnectionErrorDoesNotCauseImmediateFailure()
 {
     _mockFeatureRequestor.Setup(fr => fr.GetAllDataAsync()).ThrowsAsync(new InvalidOperationException("no"));
     using (PollingProcessor pp = new PollingProcessor(_config, _featureRequestor, _featureStore))
     {
         var  startTime = DateTime.Now;
         var  initTask  = ((IUpdateProcessor)pp).Start();
         bool completed = initTask.Wait(TimeSpan.FromMilliseconds(200));
         Assert.InRange(DateTime.Now.Subtract(startTime).Milliseconds, 190, 2000);
         Assert.False(completed);
         Assert.False(((IUpdateProcessor)pp).Initialized());
     }
 }
示例#4
0
        public void SuccessfulRequestPutsFeatureDataInStore()
        {
            AllData allData = MakeAllData();

            _mockFeatureRequestor.Setup(fr => fr.GetAllDataAsync()).ReturnsAsync(allData);
            using (PollingProcessor pp = new PollingProcessor(_config, _featureRequestor, _featureStore))
            {
                var initTask = ((IUpdateProcessor)pp).Start();
                initTask.Wait();
                Assert.Equal(Flag, _featureStore.Get(VersionedDataKind.Features, Flag.Key));
                Assert.Equal(Segment, _featureStore.Get(VersionedDataKind.Segments, Segment.Key));
                Assert.True(_featureStore.Initialized());
            }
        }
示例#5
0
 public ChatTools(EliteAPI api)
 {
     _api   = api;
     _timer = new PollingProcessor(QueueChatEntries);
     _timer.Start();
 }