public void ProcessEvents_LogFiles_CorrectNames() { MockRepository mocks = new MockRepository(); IDnaDataReaderCreator dataReaderCreator = mocks.DynamicMock<IDnaDataReaderCreator>(); IDnaHttpClientCreator httpClientCreator = mocks.DynamicMock<IDnaHttpClientCreator>(); IDnaDataReader dataReader = mocks.Stub<IDnaDataReader>(); dataReaderCreator.Stub(x => x.CreateDnaDataReader("getexmoderationevents")).Return(dataReader); dataReader.Stub(x => x.Execute()).Return(dataReader); dataReader.Stub(x => x.Read()).Return(true).Repeat.Times(1); dataReader.Stub(x => x.Read()).Return(false); dataReader.Stub(x => x.GetInt32NullAsZero("modid")).Return(0); dataReader.Stub(x => x.GetString("notes")).Return(""); dataReader.Stub(x => x.GetString("uri")).Return(""); dataReader.Stub(x => x.GetDateTime("datecompleted")).Return(DateTime.Now); dataReader.Stub(x => x.GetInt32NullAsZero("status")).Return(0); dataReader.Stub(x => x.GetString("callbackuri")).Return(""); IDnaLogger logger = new DnaLogger(); mocks.ReplayAll(); ExModerationProcessor exModProcessor = new ExModerationProcessor(dataReaderCreator, logger, httpClientCreator); exModProcessor.ProcessEvents(null); }
private void CreateExModerationEventTimer() { Uri proxyAddress = null; if (!String.IsNullOrEmpty(Properties.Settings.Default.proxyAddress)) { proxyAddress = new Uri(Properties.Settings.Default.proxyAddress); } X509Certificate cert = X509CertificateLoader.FindCertificate(GetCertificateName("ExModerationProcessor")); guideConnectionString = Properties.Settings.Default.ConnectionString_TheGuide; exModerationProcessor = PolicyInjection.Create<ExModerationProcessor>( new DnaDataReaderCreator(guideConnectionString), new DnaLogger(), new DnaHttpClientCreator(null, proxyAddress, cert)); timerPeriod = Properties.Settings.Default.SnesActivityProcessor_Interval; exModerationTimer = new Timer(exModerationProcessor.ProcessEvents, null, 0, timerPeriod); }