Exemplo n.º 1
0
        public void FixtureAppUsageFailures()
        {
            var fixture = new UiAutomationFixture();

            UiAutomationFixture.SearchBy("Name");
            Assert.IsFalse(fixture.SwitchToAppWindow(), "Cannot switch to app window if not started");
            Assert.IsFalse(fixture.SwitchToParentWindow(), "cannot switch to parent if no app launched");
            Assert.IsFalse(fixture.IsUwpApp(), "IsUwpApp returns false if no app started");
#pragma warning disable 618
            Assert.IsFalse(fixture.SwitchToWindow("irrelevant"), @"Can't switch to nonexisting window");
#pragma warning restore 618
            Assert.IsFalse(fixture.SwitchToProcess("irrelevant"));
            Assert.IsFalse(fixture.MaximizeWindow(), "Can't maximize nonexisting window");
            Assert.IsFalse(fixture.MinimizeWindow(), "Can't minimize nonexisting window");
            Assert.IsFalse(fixture.MoveWindowTo(new Coordinate(10, 10)), "Can't move nonexisting window");
            Assert.IsFalse(fixture.NormalWindow(), "Can't restore nonexisting window");
            Assert.IsFalse(fixture.ResizeWindowTo(new Coordinate(100, 100)), "Can't resize nonexisting window");
            var topleft = fixture.WindowTopLeft;
            var size    = fixture.WindowSize;
            Assert.AreEqual(0, size.X, "Width of nonexisting window is 0");
            Assert.AreEqual(0, size.Y, "height of nonexisting window is 0");
            Assert.AreEqual(0, topleft.X, "Row of nonexisting window is 0");
            Assert.AreEqual(0, topleft.Y, "Column of nonexisting window is 0");
        }