コード例 #1
0
        public void MainView_SetGet()
        {
            var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()));
            var mainView  = new MainViewStub();

            presenter.MainView = mainView;

            Assert.AreSame(mainView, presenter.MainView);
        }
コード例 #2
0
        public void ShowEventsClicked_Redirected()
        {
            var mainView  = new MainViewStub();
            var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()))
            {
                MainView = mainView
            };

            AdvAssert.Raises <EventArgs>(() => mainView.ShowEvents(), presenter, "ShowEventsClicked");
        }
コード例 #3
0
        public void StartStopClicked_WillStartServiceIfItWasStopped()
        {
            var mainView       = new MainViewStub();
            var serviceGateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub());

            new MainViewPresenter(serviceGateway)
            {
                MainView = mainView
            };

            mainView.StartStop();

            Assert.IsTrue(serviceGateway.IsStarted);
        }
コード例 #4
0
        public void StartedEventRaisedOnServiceGateway()
        {
            var mainView       = new MainViewStub();
            var serviceGateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub());

            new MainViewPresenter(serviceGateway)
            {
                MainView = mainView
            };

            serviceGateway.Start();

            Assert.AreEqual("FileWall is ON", mainView.StartStopText);
            Assert.AreEqual(Color.FromArgb(0, 192, 0), mainView.StartStopColor);
            Assert.IsTrue(mainView.StartStopEnabled);
        }
コード例 #5
0
        public void MainView_AllCountersWillSetZeroWhenGatewayStopped()
        {
            var mainView = new MainViewStub
            {
                FilesysBlocks   = 1,
                FilesysPermits  = 2,
                RegistryBlocks  = 3,
                RegistryPermits = 4
            };
            var presenter = new MainViewPresenter(new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub()));

            // If gateway is stopped, presenter must zero all counters in view.
            presenter.MainView = mainView;

            Assert.AreEqual(0u, mainView.FilesysBlocks);
            Assert.AreEqual(0u, mainView.FilesysPermits);
            Assert.AreEqual(0u, mainView.RegistryBlocks);
            Assert.AreEqual(0u, mainView.RegistryPermits);

            Assert.AreEqual("FileWall is OFF", mainView.StartStopText);
            Assert.AreEqual(Color.Red, mainView.StartStopColor);
            Assert.IsTrue(mainView.StartStopEnabled);
        }
コード例 #6
0
        public void MainView_AllCountersWillSetWhenGatewayStarted()
        {
            var mainView       = new MainViewStub();
            var serviceGateway = new ServiceGateway(new AdvSCStub(), new ServiceInterfaceManagerStub());

            serviceGateway.Start();
            serviceGateway.ServiceInterface.FilesysBlocks   = 1;
            serviceGateway.ServiceInterface.FilesysPermits  = 2;
            serviceGateway.ServiceInterface.RegistryBlocks  = 3;
            serviceGateway.ServiceInterface.RegistryPermits = 4;
            var presenter = new MainViewPresenter(serviceGateway);

            // If gateway is started, presenter must fetch counters values and refresh view.
            presenter.MainView = mainView;

            Assert.AreEqual(1u, mainView.FilesysBlocks);
            Assert.AreEqual(2u, mainView.FilesysPermits);
            Assert.AreEqual(3u, mainView.RegistryBlocks);
            Assert.AreEqual(4u, mainView.RegistryPermits);

            Assert.AreEqual("FileWall is ON", mainView.StartStopText);
            Assert.AreEqual(Color.FromArgb(0, 192, 0), mainView.StartStopColor);
            Assert.IsTrue(mainView.StartStopEnabled);
        }
コード例 #7
0
ファイル: MainViewStub.cs プロジェクト: y11en/FileWall
        public void StartStop_RaisesEvent()
        {
            var mainView = new MainViewStub();

            AdvAssert.Raises <EventArgs>(() => mainView.StartStop(), mainView, "StartStopClicked");
        }
コード例 #8
0
ファイル: MainViewStub.cs プロジェクト: y11en/FileWall
        public void ShowEvents_RaisesEvent()
        {
            var mainView = new MainViewStub();

            AdvAssert.Raises <EventArgs>(() => mainView.ShowEvents(), mainView, "ShowEventsClicked");
        }