public void ApplyPresetLocation_NoSelectedWindows_ShouldNotCallRelocateWindow()
        {
            // Prepare
            var location = new Location(HorizontalLocationType.Left, VerticalLocationType.Center);

            var eventAggregatorMock = new Mock <IEventAggregator>();
            var activeWindowsSelectionChangedEventMock = new Mock <ActiveWindowsSelectionChangedEvent>();

            eventAggregatorMock.Setup(x => x.GetEvent <ActiveWindowsSelectionChangedEvent>()).Returns(activeWindowsSelectionChangedEventMock.Object);

            var windowServiceMock  = new Mock <IWindowService>();
            var displayServiceMock = new Mock <IDisplayService>();

            var viewModel = new LocatorViewModel(eventAggregatorMock.Object, windowServiceMock.Object, displayServiceMock.Object)
            {
                SelectedDisplay = new Display {
                    WorkArea = new Rect {
                        Left = 0, Top = 0, Right = 500, Bottom = 500
                    }
                }
            };

            // Act
            viewModel.ApplyPresetLocation(location);

            // Assert
            windowServiceMock.Verify(x => x.RelocateWindow(It.IsAny <Domain.Windows.Window>(), It.IsAny <Rect>()), Times.Never());
        }
        public void ApplyPresetLocation_ValidLocation_ShouldCreateRect()
        {
            // Prepare
            var  location = new Location(HorizontalLocationType.Left, VerticalLocationType.Top);
            Rect?sendRect = default;

            var eventAggregatorMock = new Mock <IEventAggregator>();
            var activeWindowsSelectionChangedEventMock = new Mock <ActiveWindowsSelectionChangedEvent>();

            eventAggregatorMock.Setup(x => x.GetEvent <ActiveWindowsSelectionChangedEvent>()).Returns(activeWindowsSelectionChangedEventMock.Object);

            var windowServiceMock = new Mock <IWindowService>();

            windowServiceMock.Setup(x => x.RelocateWindow(It.IsAny <Domain.Windows.Window>(), It.IsAny <Rect>()))
            .Callback <Domain.Windows.Window, Rect>((window, rect) => sendRect = rect);

            var displayServiceMock = new Mock <IDisplayService>();

            var viewModel = new LocatorViewModel(eventAggregatorMock.Object, windowServiceMock.Object, displayServiceMock.Object)
            {
                SelectedDisplay = new Display {
                    WorkArea = new Rect {
                        Left = 0, Top = 0, Right = 500, Bottom = 500
                    }
                }
            };

            viewModel.SelectedWindows.Add(new Domain.Windows.Window());

            // Act
            viewModel.ApplyPresetLocation(location);

            // Assert
            windowServiceMock.Verify(x => x.RelocateWindow(It.IsAny <Domain.Windows.Window>(), It.IsAny <Rect>()), Times.Once());
            Assert.Equal(new Rect(), sendRect);
        }