コード例 #1
0
ファイル: FormMainStub.cs プロジェクト: y11en/FileWall
        public void ShowMessageBox()
        {
            var stub = new FormMainStub();

            Assert.IsNull(stub.ShownMessage);

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

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

            Assert.IsTrue(presenter.LogViewPresenter.DetailsVisible);
        }
コード例 #3
0
        public void RefreshEvents()
        {
            var logViewModelMock = new LogViewModelMock();

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

            _Form.RefreshEvents();

            Assert.IsTrue(logViewModelMock.IsRefreshed);
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: FormMainStub.cs プロジェクト: y11en/FileWall
        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);
        }
コード例 #7
0
ファイル: FormMainStub.cs プロジェクト: y11en/FileWall
        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);
        }