public void CreateLogViewWhichIsNotActive()
        {
            StumpMother mother = new StumpMother();

            ILogView    view    = MockRepository.GenerateMock <ILogView>();
            ILogMonitor monitor = mother.LogMonitors[0];

            view.Expect(v => v.IsLogDisplayActive).Return(false);

            monitor.Expect(m => m.StartMonitoring("d:/log1.txt", null, null, null, null))
            .IgnoreArguments().Repeat.Once();
            monitor.Expect(m => m.StopMonitoring()).Repeat.Once();

            using (LogPresenter presenter = new LogPresenter(
                       view,
                       monitor,
                       mother.LogUpdaterQueue,
                       mother.Workspace.LogFiles[0]))
            {
            }

            view.AssertWasNotCalled(v => v.ShowLogContents("logContents1"));
            view.VerifyAllExpectations();
            monitor.VerifyAllExpectations();
        }
        public void CreateLogViewWhichIsActive()
        {
            StumpMother mother = new StumpMother();

            ILogView    view    = MockRepository.GenerateMock <ILogView>();
            ILogMonitor monitor = mother.LogMonitors[0];

            mother.LogUpdaterQueue.Expect(lr => lr.FetchLogContents("d:/log1.txt", null))
            .Constraints(Is.Equal("d:/log1.txt"), Is.Anything())
            .Do((Action <string, LogContentsFetchedCallback>) delegate { view.ShowLogContents("logContents1"); });

            view.Expect(v => v.IsLogDisplayActive).Return(true);
            view.Expect(v => v.ShowLogContents("logContents1"));

            monitor.Expect(m => m.StartMonitoring("d:/log1.txt", null, null, null, null))
            .IgnoreArguments().Repeat.Once();
            monitor.Expect(m => m.StopMonitoring()).Repeat.Once();

            using (LogPresenter presenter = new LogPresenter(
                       view,
                       monitor,
                       mother.LogUpdaterQueue,
                       mother.Workspace.LogFiles[0]))
            {
            }

            view.VerifyAllExpectations();
            monitor.VerifyAllExpectations();
        }
Beispiel #3
0
        public void SelectTab()
        {
            StumpMother mother = new StumpMother();

            ILogTabsView view = MockRepository.GenerateMock <ILogTabsView>();

            view.Expect(v => v.SwitchToLog(1));

            LogTabsPresenter presenter = new LogTabsPresenter(view, mother.Workspace);

            presenter.OnTabSelected(1);

            view.VerifyAllExpectations();
        }
Beispiel #4
0
        public void ShowMultipleLogTabs()
        {
            StumpMother mother = new StumpMother();

            ILogTabsView view = MockRepository.GenerateMock <ILogTabsView>();

            view.Expect(v => v.AddTab(new LogTabData("log1.txt", "d:/log1.txt")));
            view.Expect(v => v.AddTab(new LogTabData("log2.txt", "d:/log2.txt")));
            view.Expect(v => v.AddTab(new LogTabData("log3.txt", "d:/log3.txt")));
            view.Expect(v => v.SwitchToLog(0));

            LogTabsPresenter presenter = new LogTabsPresenter(view, mother.Workspace);

            view.VerifyAllExpectations();
        }
        public void StopMonitoring()
        {
            StumpMother mother = new StumpMother();

            ILogView    view    = MockRepository.GenerateMock <ILogView>();
            ILogMonitor monitor = mother.LogMonitors[0];

            view.Expect(v => v.IsLogDisplayActive).Return(true);
            view.Expect(v => v.IndicateLogFileNotMonitored());

            using (LogPresenter presenter = new LogPresenter(
                       view,
                       monitor,
                       mother.LogUpdaterQueue,
                       mother.Workspace.LogFiles[0]))
            {
                // turn off monitoring
                presenter.OnMonitoringEnabledToggled();
            }

            view.VerifyAllExpectations();
            monitor.VerifyAllExpectations();
        }
        public void CreateLogViewWhichIsActiveButNotMonitored()
        {
            StumpMother mother = new StumpMother();

            mother.Workspace.LogFiles[0].IsActive = false;

            ILogView    view    = MockRepository.GenerateMock <ILogView>();
            ILogMonitor monitor = mother.LogMonitors[0];

            view.Expect(v => v.IsLogDisplayActive).Return(true);
            view.Expect(v => v.IndicateLogFileNotMonitored());

            using (LogPresenter presenter = new LogPresenter(
                       view,
                       monitor,
                       mother.LogUpdaterQueue,
                       mother.Workspace.LogFiles[0]))
            {
            }

            monitor.AssertWasNotCalled(m => m.StartMonitoring(null, null, null, null, null));
            view.VerifyAllExpectations();
            monitor.VerifyAllExpectations();
        }