private void SetChannelWithTimeSpan(TimeSpan timeSpan) { _storage.DeleteLogsAsync(ChannelName).Wait(); _channel = new Mobile.Channel.Channel(ChannelName, MaxLogsPerBatch, timeSpan, MaxParallelBatches, _appSecret, _mockIngestion, _storage); MakeIngestionCallsSucceed(); SetupEventCallbacks(); }
public void ThrowStorageExceptionInDeleteLogsTime() { var storage = new Mock <IStorage>(); storage.Setup(s => s.DeleteLogs(It.IsAny <string>(), It.IsAny <string>())).Throws <StorageException>(); storage.Setup(s => s.GetLogsAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <List <Log> >())).Returns(Task.FromResult("")); Mobile.Channel.Channel channel = new Mobile.Channel.Channel("name", 1, _batchTimeSpan, 1, _appSecret, _mockIngestion, storage.Object); // Shutdown channel and store some log channel.ShutdownAsync().RunNotAsync(); channel.EnqueueAsync(new TestLog()).RunNotAsync(); channel.SetEnabled(true); // Not throw any exception }