private void WithMonitorType(MonitorTypes monitor) { Mocker.GetMock <IImportListFactory>() .Setup(v => v.Get(It.IsAny <int>())) .Returns(new ImportListDefinition { ShouldMonitor = monitor }); }
public void should_add_if_not_existing_series(MonitorTypes monitor, bool expectedSeriesMonitored) { WithTvdbId(); WithMonitorType(monitor); Subject.Execute(new ImportListSyncCommand()); Mocker.GetMock <IAddSeriesService>() .Verify(v => v.AddSeries(It.Is <List <Series> >(t => t.Count == 1 && t.First().Monitored == expectedSeriesMonitored), It.IsAny <bool>())); }
private void SetTypeForTcpStreamGenerator(TcpStreamGenerator sg, MonitorTypes monitorType) { if (sg == streamGenerator0) { MonitorTypeFlow0 = monitorType; } else { MonitorTypeFlow1 = monitorType; } }
/// <summary> /// Based on a given monitor type determine what the other flow's monitor type /// is /// </summary> /// <param name="monitorType"> /// A <see cref="MonitorTypes"/> /// </param> /// <returns> /// A <see cref="MonitorTypes"/> /// </returns> private static MonitorTypes GetOtherMonitorType(MonitorTypes monitorType) { if (monitorType == MonitorTypes.Client) { return(MonitorTypes.Server); } else if (monitorType == MonitorTypes.Server) { return(MonitorTypes.Client); } else { return(MonitorTypes.Unknown); } }
private HttpMessage.ProcessStatus ProcessBinaryReader(HttpMessage theMessage, MonitorTypes monitorType, BinaryReader br) { HttpMessage.ProcessStatus status; status = theMessage.Process(br); if (IsDebugEnabled) { log.DebugFormat("status == {0}", status); } if (status == HttpMessage.ProcessStatus.Error) { log.Debug("ProcessStatus.Error"); } else if (status == HttpMessage.ProcessStatus.Complete) { // send a completed notification to the appropriate handler if (monitorType == MonitorTypes.Client) { if (OnHttpRequestFound != null) { if (IsDebugEnabled) { log.Debug("Calling OnHttpRequestFound() delegates"); } try { OnHttpRequestFound(new HttpSessionWatcherRequestEventArgs(this, pendingRequest)); } catch (System.Exception) { // drop all exceptions thrown from handlers, its not our issue } } // put this request into requests waiting for status queue requestsWaitingForStatus.Enqueue(pendingRequest); // clear out the pendingRequest since we finished with it pendingRequest = null; } else if (monitorType == MonitorTypes.Server) { // do we have any pending requests? if so we should // dequeue one of them and assign it to the pendingStatus // so the user can match the status with the request if (requestsWaitingForStatus.Count != 0) { pendingStatus.Request = requestsWaitingForStatus.Dequeue(); } if (OnHttpStatusFound != null) { if (IsDebugEnabled) { log.Debug("Calling OnHttpStatusFound() delegates"); } try { OnHttpStatusFound(new HttpSessionWatcherStatusEventArgs(this, pendingStatus)); } catch (System.Exception) { // drop all exceptions thrown from handlers, its not our issue } } // clear out the pendingStatus since we finished with it pendingStatus = null; } // return completion status = HttpMessage.ProcessStatus.Complete; } else if (status == HttpMessage.ProcessStatus.NeedMoreData) { // need more data, return with our current position } return(status); }