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); }
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"); }
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); }
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); }
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); }
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); }
public void StartStop_RaisesEvent() { var mainView = new MainViewStub(); AdvAssert.Raises <EventArgs>(() => mainView.StartStop(), mainView, "StartStopClicked"); }
public void ShowEvents_RaisesEvent() { var mainView = new MainViewStub(); AdvAssert.Raises <EventArgs>(() => mainView.ShowEvents(), mainView, "ShowEventsClicked"); }