public void TestGetLeft() { // setup Workspace.Current.Configuration = new Configuration(); double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(margin, WindowOperator.GetLeft(null)); }
private void Locate() { MainWindow window = MainWindow.Current; Direction direction = this.Direction; if (direction == Direction.Left || direction == Direction.Right) { window.Top = WindowOperator.GetTop(window, this.Position); } else { window.Left = WindowOperator.GetLeft(window, this.Position); } }
protected override double?GetToPropertyValue() { MainWindow window = MainWindow.Current; Direction direction = this.Direction; if (direction == Direction.Left || direction == Direction.Right) { return(WindowOperator.GetLeft(window, this.Position)); } else { return(WindowOperator.GetTop(window, this.Position)); } }
public void TestGetLeftWithPosition() { // setup MainWindow window = new MainWindow(); MainWindow.Current = window; double margin = Workspace.Current.Configuration.DesktopMargin; // expect Assert.AreEqual(margin, WindowOperator.GetLeft(window, Position.LeftTop)); Assert.AreEqual(margin, WindowOperator.GetLeft(window, Position.LeftMiddle)); Assert.AreEqual(margin, WindowOperator.GetLeft(window, Position.LeftBottom)); Assert.AreEqual(window.ScreenWidth / 2, WindowOperator.GetLeft(window, Position.CenterTop)); Assert.AreEqual(window.ScreenWidth / 2, WindowOperator.GetLeft(window, Position.CenterMiddle)); Assert.AreEqual(window.ScreenWidth / 2, WindowOperator.GetLeft(window, Position.CenterBottom)); Assert.AreEqual(window.ScreenWidth - margin, WindowOperator.GetLeft(window, Position.RightTop)); Assert.AreEqual(window.ScreenWidth - margin, WindowOperator.GetLeft(window, Position.RightMiddle)); Assert.AreEqual(window.ScreenWidth - margin, WindowOperator.GetLeft(window, Position.RightBottom)); }