Beispiel #1
0
        public void ShowMessageBox()
        {
            var stub = new FormMainStub();

            Assert.IsNull(stub.ShownMessage);

            stub.ShowMessageBox("hello world!");
            Assert.AreEqual("hello world!", stub.ShownMessage);
        }
        public void ShowEventDetails()
        {
            var form      = new FormMainStub();
            var presenter = new FormMainPresenter(form, _ServiceGateway, _LogViewModel);

            form.ShowEvents();
            form.ShowEventDetails();

            Assert.IsTrue(presenter.LogViewPresenter.DetailsVisible);
        }
        public void RefreshEvents()
        {
            var logViewModelMock = new LogViewModelMock();

            _Form      = new FormMainStub();
            _Presenter = new FormMainPresenter(_Form, _ServiceGateway, logViewModelMock);

            _Form.RefreshEvents();

            Assert.IsTrue(logViewModelMock.IsRefreshed);
        }
        public void TestInitialize()
        {
            _Form             = new FormMainStub();
            _InterfaceManager = new ServiceInterfaceManagerStub();

            // Redirect all calls to AdvSCStub and ServiceInterfaceManagerStub to avoid creating accessing system resources.
            _ServiceGateway = new ServiceGateway(new AdvSCStub(), _InterfaceManager);

            _LogViewModel = new LogViewModelMock();
            _Presenter    = new FormMainPresenter(_Form, _ServiceGateway, _LogViewModel);

            _ServiceGateway.Start();
        }
        public void ShowEvents()
        {
            var logViewModelMock = new LogViewModelMock();

            _Form      = new FormMainStub();
            _Presenter = new FormMainPresenter(_Form, _ServiceGateway, logViewModelMock);

            _Form.ShowEvents();

            Assert.IsTrue(_Form.DisplayedControl is LogViewControl);
            Assert.IsTrue(((Control)_Form.DisplayedControl).Dock == DockStyle.Fill);
            Assert.AreSame(_Form.DisplayedControl, _Presenter.LogViewPresenter.LogView);

            AssertEventsRibbonVisible(true);
            Assert.IsTrue(logViewModelMock.IsRefreshed);
        }
Beispiel #6
0
        public void TestEventInvokators()
        {
            var stub = new FormMainStub();

            AdvAssert.Raises <EventArgs>(() => stub.ShowMain(), stub, "ShowMainClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ShowRules(), stub, "ShowRulesClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ShowPreferences(), stub, "ShowPreferencesClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ShowEvents(), stub, "ShowEventsClicked");
            AdvAssert.Raises <EventArgs>(() => stub.CloseAll(), stub, "CloseAllClicked");
            AdvAssert.Raises <EventArgs>(() => stub.RefreshRules(), stub, "RefreshRulesClicked");
            AdvAssert.Raises <EventArgs>(() => stub.RefreshEvents(), stub, "RefreshEventsClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ExitAndShutDown(), stub, "ExitAndShutDownClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ClearEvents(), stub, "ClearEventsClicked");
            AdvAssert.Raises <EventArgs>(() => stub.ShowEventDetails(), stub, "ShowEventDetailsClicked");
            AdvAssert.Raises <ExportEventsEventArgs>(() => stub.ExportEvents(), stub, "ExportEventsClicked");
            AdvAssert.Raises <EventArgs>(() => stub.AutoRefreshEventsSetCheck(true), stub, "AutoRefreshEventsCheckChanged");
            Assert.IsTrue(stub.AutoRefreshEvents);
        }
Beispiel #7
0
        public void SelectedPage_CreatesControls()
        {
            var mainForm = new FormMainStub();

            mainForm.SelectedPage = FormMainPage.Main;
            Assert.IsTrue(mainForm.DisplayedControl is MainViewStub);

            mainForm.SelectedPage = FormMainPage.Rules;
            Assert.IsTrue(mainForm.DisplayedControl is RulesetGrid);
            Assert.AreEqual(DockStyle.Fill, ((Control)mainForm.DisplayedControl).Dock);

            mainForm.SelectedPage = FormMainPage.Events;
            Assert.IsTrue(mainForm.DisplayedControl is LogViewControl);
            Assert.AreEqual(DockStyle.Fill, ((Control)mainForm.DisplayedControl).Dock);

            mainForm.SelectedPage = FormMainPage.Preferences;
            Assert.IsTrue(mainForm.DisplayedControl is PreferencesControl);
            Assert.AreEqual(DockStyle.Fill, ((Control)mainForm.DisplayedControl).Dock);
        }