public void TestInitialize()
 {
     _service = Substitute.For <ILogService>();
     _view    = Substitute.For <ILogView>();
     _sut     = new LogPresenter(_service);
     _sut.Bind(_view);
 }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        public Form1()
        {
            this.InitializeComponent();
            this.InitLookUpTypes();
            LogPresenter presenter = new LogPresenter(this);

            this._txtLoggingType.EditValueChanged += (s, a) => this.LogTypeChanged?.Invoke();
        }
Exemplo n.º 5
0
        protected override object CreatePresenter()
        {
            LogPresenter managerPre = new LogPresenter(this);

            for (int i = 0; i < allPresenterList.Count; i++)
            {
                if (allPresenterList[i].GetType() == typeof(LogPresenter))
                {
                    allPresenterList.RemoveAt(i);
                }
            }
            allPresenterList.Add(managerPre);
            return(managerPre);
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        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();
        }
 public void TestCleanup()
 {
     _service = null;
     _view    = null;
     _sut     = null;
 }
Exemplo n.º 9
0
 public Log()
 {
     InitializeComponent();
     _presenter = new LogPresenter(this);
 }