private void SendReportUsingFilter(string filterString, EventSource source = EventSource.EventLog, string externalEvents = "")
        {
            var filterConfig   = new FilterConfiguration(filterString, TimeSpan.FromHours(12), 100, "", "Security", eventSource: source, externalEventsXml: externalEvents);
            var logEventFilter = new LogEventFilter(_eventReader, filterConfig);

            _radonExecutor = new RadonExecutor(_currentEmailConfig, filterConfig, _mockEventIdentificationStore, logEventFilter);
            _radonExecutor.SendReport(_radonExecutor.GetLogEvents());
        }
示例#2
0
        public void TestFixtureSetUp()
        {
            _mockReportSender             = MockRepository.GenerateMock <IReportSender>();
            _mockEmailConfiguration       = MockRepository.GenerateMock <IEmailConfiguration>();
            _mockFilterConfiguration      = MockRepository.GenerateMock <IFilterConfiguration>();
            _mockEventIdentificationStore = MockRepository.GenerateMock <IEventIdentificationStore>();
            _mockEventReader = MockRepository.GenerateMock <IEventReader>();

            _radonExecutor = new RadonExecutor(_mockEmailConfiguration, _mockFilterConfiguration, _mockEventIdentificationStore, _mockEventReader);
        }
        public void ShouldUseExternalEventsSourceIfSelected()
        {
            var filterConfig = new FilterConfiguration("1=1", TimeSpan.FromHours(12), 100, "", Path.GetRandomFileName(), EventSource.External, "<Events><Event><Message>External event message</Message></Event></Events>");
            var mockConfig   = MockRepository.GenerateMock <IRadonConfigurationManager>();

            mockConfig.Expect(c => c.GetEmailConfig()).Return(_currentEmailConfig);
            mockConfig.Expect(c => c.GetFilterConfig()).Return(filterConfig);

            _radonExecutor = new RadonExecutor(mockConfig);
            _radonExecutor.SendReport(_radonExecutor.GetLogEvents());

            Assert.That(_smtpServer.ReceivedEmailCount, Is.EqualTo(1), "An email should have been sent");

            var body = SmtpSenderTest.ParseMessageBody(_smtpServer.ReceivedEmail.Single().Body);

            Assert.That(body, Does.Contain("External event message"));
        }
 public void Setup()
 {
     _mockRadonExecutor = MockRepository.GenerateMock <IRadonExecutor>();
     _radonProgram      = new RadonProgram(_mockRadonExecutor);
 }
 public RadonProgram(IRadonExecutor executor)
 {
     _executor = executor;
 }