public void Now_CallsMoveWindowWithScreenWorkingAreaXAndYPlusHalfWorkingHeightWorkingHeightAndHalfWorkingheight( int workingX, int workingY, int workingWidth, int workingHeight) { using (ShimsContext.Create()) { // Arrange var screen = Substitute.For<IScreen>(); var moveWindow = Substitute.For<IMoveWindow>(); var halfWorkingHeight = workingHeight / 2; var screenShim = new ShimScreen { WorkingAreaGet = () => new Rectangle(workingX, workingY, workingWidth, workingHeight) }; screen.Value.Returns(screenShim); var sut = new SplitActiveWindowToHalfBottomOnCurrentScreen(screen, moveWindow); // Act sut.Now(); // Assert moveWindow.Received(1).To(workingX, workingY + halfWorkingHeight, workingWidth, halfWorkingHeight); } }
/// <summary> /// Build IExecutionMain and start the logic. /// </summary> public void Execute() { IWindowHandle windowHandle = new LastActiveWindowHandle(); IScreen screen = new ActiveWindowDependendScreen(windowHandle); IMoveWindow moveWindow = new MoveActiveWindow(windowHandle); IChangeWindowPosition position = new SplitActiveWindowToHalfBottomOnCurrentScreen(screen, moveWindow); IWindowTitle windowTitle = new ActiveWindowTitle(windowHandle); IPluginState pluginState = new ActiveWindowTitleNotStartMenuePluginState(windowTitle); IExecutionMain executionMain = new MoveActiveWindowPositionExecutionMain(position, pluginState); executionMain.Run(); }