Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(string, string, bool, System.Globalization.CultureInfo, string, params object[])

Here are the examples of the csharp api Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(string, string, bool, System.Globalization.CultureInfo, string, params object[]) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1690 Examples 7

19 View Source File : ActionsPen.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Pen_LongClick()
        {
            // Create a new test alarm
            string alarmName = "LongTapTest";
            DeletePreviouslyCreatedAlarmEntry(alarmName);
            AddAlarmEntry(alarmName);
            Thread.Sleep(TimeSpan.FromSeconds(3));

            var alarmEntries = session.FindElementsByXPath($"//Lisreplacedem[starts-with(@Name, \"{alarmName}\")]");
            replacedert.IsNotNull(alarmEntries);
            replacedert.AreEqual(1, alarmEntries.Count);

            // Open a the context menu on the alarm entry using long tap (press and hold) action and click delete
            PointerInputDevice penDevice = new PointerInputDevice(PointerKind.Pen);
            ActionSequence sequence = new ActionSequence(penDevice, 0);
            sequence.AddAction(penDevice.CreatePointerMove(alarmEntries[0], 0, 0, TimeSpan.Zero));
            sequence.AddAction(penDevice.CreatePointerDown(PointerButton.PenContact));
            sequence.AddAction(penDevice.CreatePointerMove(alarmEntries[0], 0, 0, TimeSpan.FromSeconds(3)));
            sequence.AddAction(penDevice.CreatePointerUp(PointerButton.PenContact));
            session.PerformActions(new List<ActionSequence> { sequence });

            Thread.Sleep(TimeSpan.FromSeconds(1));
            session.FindElementByName("Delete").Click();
            Thread.Sleep(TimeSpan.FromSeconds(1));

            alarmEntries = session.FindElementsByXPath($"//Lisreplacedem[starts-with(@Name, \"{alarmName}\")]");
            replacedert.IsNotNull(alarmEntries);
            replacedert.AreEqual(0, alarmEntries.Count);
        }

19 View Source File : ActionsTouch.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Touch_DragAndDrop()
        {
            WindowsElement appNamereplacedle = FindAppreplacedleBar();
            const int offset = 100;

            // Save application window original position
            Point originalPosition = session.Manage().Window.Position;
            replacedert.IsNotNull(originalPosition);

            // Send touch down, move, and up actions combination to perform a drag and drop 
            // action on the app replacedle bar. These actions reposition the application window.
            PointerInputDevice touchDevice = new PointerInputDevice(PointerKind.Touch);
            ActionSequence sequence = new ActionSequence(touchDevice, 0);
            sequence.AddAction(touchDevice.CreatePointerMove(appNamereplacedle, 0, 0, TimeSpan.Zero));
            sequence.AddAction(touchDevice.CreatePointerDown(PointerButton.TouchContact));
            sequence.AddAction(touchDevice.CreatePointerMove(CoordinateOrigin.Pointer, offset, offset, TimeSpan.FromSeconds(1)));
            sequence.AddAction(touchDevice.CreatePointerUp(PointerButton.TouchContact));
            session.PerformActions(new List<ActionSequence> { sequence });
            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Verify that application window is now re-positioned from the original location
            replacedert.AreNotEqual(originalPosition, session.Manage().Window.Position);
            replacedert.IsTrue(originalPosition.Y < session.Manage().Window.Position.Y);

            // Restore application window original position
            session.Manage().Window.Position = originalPosition;
            replacedert.AreEqual(originalPosition, session.Manage().Window.Position);
        }

19 View Source File : AppiumAppLaunch.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Launch_SystemApp()
        {
            session = Utility.CreateNewSession(CommonTestSettings.ExplorerAppId);
            var originalSessionId = session.SessionId;
            var originalreplacedle = session.replacedle;
            var originalWindowHandlesCount = session.WindowHandles.Count;
            var originalLaunchedWindowHandle = session.CurrentWindowHandle;

            // Re-launch Windows Explorer in the same session using the same capabilities configuration
            // This will create a new explorer window and point the current active session to it
            session.LaunchApp();
            replacedert.AreEqual(originalSessionId, session.SessionId);
            replacedert.AreEqual(originalreplacedle, session.replacedle);
            replacedert.AreEqual(originalWindowHandlesCount + 1, session.WindowHandles.Count);
            replacedert.AreNotEqual(originalLaunchedWindowHandle, session.CurrentWindowHandle);

            session.Close();
            session.SwitchTo().Window(originalLaunchedWindowHandle);
            session.Close();
        }

19 View Source File : Back.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void NavigateBack_Browser()
        {
            session = Utility.CreateNewSession(CommonTestSettings.EdgeAppId, "-private " + CommonTestSettings.EdgeAboutFlagsURL);
            session.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
            Thread.Sleep(TimeSpan.FromSeconds(2.5));
            var originalreplacedle = session.replacedle;
            replacedert.AreNotEqual(string.Empty, originalreplacedle);

            // Navigate to different URLs
            session.FindElementByAccessibilityId("addressEditBox").SendKeys(Keys.Alt + 'd' + Keys.Alt + CommonTestSettings.EdgeAboutBlankURL + Keys.Enter);
            Thread.Sleep(TimeSpan.FromSeconds(1));
            replacedert.AreNotEqual(originalreplacedle, session.replacedle);

            // Navigate back to original URL
            session.Navigate().Back();
            Thread.Sleep(TimeSpan.FromSeconds(3));
            replacedert.AreEqual(originalreplacedle, session.replacedle);
            EdgeBase.CloseEdge(session);
        }

19 View Source File : Element.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementError_NoSuchElementByClreplacedName()
        {
            try
            {
                WindowsElement element = session.FindElementByClreplacedName("InvalidClreplacedName");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchElement, exception.Message);
            }
        }

19 View Source File : Element.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementError_NoSuchElementByRuntimeId()
        {
            try
            {
                WindowsElement element = session.FindElementById("InvalidRuntimeId");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchElement, exception.Message);
            }
        }

19 View Source File : Element.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementError_NoSuchElementByTagNameMalformed()
        {
            try
            {
                WindowsElement element = session.FindElementByTagName("//@InvalidTagNameMalformed");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchElement, exception.Message);
            }
        }

19 View Source File : ElementActive.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetActiveElement_FocusableElement()
        {
            WindowsElement num8Button = session.FindElementByAccessibilityId("num8Button");
            num8Button.Click();
            WindowsElement activeElement = session.SwitchTo().ActiveElement() as WindowsElement;
            replacedert.IsNotNull(activeElement);
            replacedert.AreEqual(num8Button, activeElement);

            WindowsElement plusButton = session.FindElementByAccessibilityId("plusButton");
            plusButton.Click();
            WindowsElement activeElementAfter = session.SwitchTo().ActiveElement() as WindowsElement;
            replacedert.IsNotNull(activeElementAfter);
            replacedert.AreEqual(plusButton, activeElementAfter);
            replacedert.AreNotEqual(activeElement, activeElementAfter);
        }

19 View Source File : ElementLocationInView.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetElementLocationInViewError_StaleElement()
        {
            try
            {
                var locationInView = GetStaleElement().LocationOnScreenOnceScrolledIntoView;
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.StaleElementReference, exception.Message);
            }
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElements_ByAccessibilityId()
        {
            var elements = session.FindElementsByAccessibilityId(AlarmTabAutomationId);
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(1, elements.Count);
            replacedert.IsTrue(elements.Contains(alarmTabElement));
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_AccessibilityId()
        {
            var elements = session.FindElementsByAccessibilityId("NonExistentAccessibiliyId");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_ClreplacedName()
        {
            var elements = session.FindElementsByClreplacedName("NonExistentClreplacedName");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_Name()
        {
            var elements = session.FindElementsByName("NonExistentName");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_RuntimeId()
        {
            var elements = session.FindElementsById("NonExistentRuntimeId");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_TagName()
        {
            var elements = session.FindElementsByTagName("NonExistentTagName");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsByNonExistent_XPath()
        {
            var elements = session.FindElementsByXPath("//NonExistentElement");
            replacedert.IsNotNull(elements);
            replacedert.AreEqual(0, elements.Count);
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsError_NoSuchWindow()
        {
            try
            {
                var elements = Utility.GetOrphanedSession().FindElementsByAccessibilityId("An accessibility id");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsError_UnsupportedLocatorCSSSelector()
        {
            try
            {
                var elements = session.FindElementsByCssSelector("Query");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (WebDriverException exception)
            {
                replacedert.AreEqual(string.Format(ErrorStrings.UnimplementedCommandLocator, "css selector"), exception.Message);
            }
        }

19 View Source File : Elements.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void FindElementsError_UnsupportedLocatorPartialLinkText()
        {
            try
            {
                var elements = session.FindElementsByPartialLinkText("Query");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (WebDriverException exception)
            {
                replacedert.AreEqual(string.Format(ErrorStrings.UnimplementedCommandLocator, "partial link text"), exception.Message);
            }
        }

19 View Source File : ElementSelected.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetElementSelectedStateError_NoSuchWindow()
        {
            try
            {
                var selected = Utility.GetOrphanedElement().Enabled;
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : ElementSelected.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetElementSelectedStateError_StaleElement()
        {
            try
            {
                var selected = GetStaleElement().Selected;
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.StaleElementReference, exception.Message);
            }
        }

19 View Source File : ElementSendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeysToElement_ModifierAlt()
        {
            alarmNameTextBox.SendKeys(Keys.Space);
            replacedert.AreEqual("true", alarmNameTextBox.GetAttribute("HasKeyboardFocus"));
            alarmNameTextBox.SendKeys(Keys.Alt + Keys.Enter + Keys.Alt); // Alt + Enter moves the focus to the next element
            replacedert.AreEqual("false", alarmNameTextBox.GetAttribute("HasKeyboardFocus"));
        }

19 View Source File : ElementText.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetElementText()
        {
            // Pivot Item element returns the name
            WindowsElement pivoreplacedem = session.FindElementByAccessibilityId(StopwatchTabAutomationId);
            replacedert.IsTrue(pivoreplacedem.Text.StartsWith("Stopwatch")); // StopWatchPivoreplacedem text is Stopwatch or Stopwatch tab on older app version

            // Button element returns the button name
            WindowsElement button = session.FindElementByAccessibilityId("AddAlarmButton");
            replacedert.IsTrue(button.Text.Equals("Add new alarm") || button.Text.Equals("New")); // Add new alarm button is New on older app version
            button.Click();
            System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));

            // TextBlock element returns the text value
            WindowsElement textBlock = session.FindElementByAccessibilityId("EditAlarmHeader");
            replacedert.AreEqual("NEW ALARM", textBlock.Text);

            // List element returns the value of the selected list item
            WindowsElement list = session.FindElementByAccessibilityId("MinuteLoopingSelector");
            replacedert.AreEqual("00", list.Text);

            // TextBox element returns the text value
            WindowsElement textBox = session.FindElementByAccessibilityId("AlarmNameTextBox");
            textBox.Clear();
            replacedert.AreEqual(string.Empty, textBox.Text);
            textBox.SendKeys("Test alarm name text box!");
            replacedert.AreEqual("Test alarm name text box!", textBox.Text);
        }

19 View Source File : Mouse.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void MouseDownMoveUp()
        {
            const int offset = 100;
            WindowsElement appNamereplacedle = session.FindCalculatorreplacedleByAccessibilityId();
            replacedert.IsNotNull(appNamereplacedle);

            // Save application window original position
            Point originalPosition = session.Manage().Window.Position;
            replacedert.IsNotNull(originalPosition);

            // Send mouse down, move, and up actions combination to perform a drag and drop 
            // action on the app replacedle bar. These actions reposition Calculator window.
            session.Mouse.MouseMove(appNamereplacedle.Coordinates);
            session.Mouse.MouseDown(null); // Preplaced null as this command omit the given parameter
            session.Mouse.MouseMove(appNamereplacedle.Coordinates, offset, offset);
            session.Mouse.MouseUp(null); // Preplaced null as this command omit the given parameter
            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Verify that application window is now re-positioned from the original location
            replacedert.AreNotEqual(originalPosition, session.Manage().Window.Position);
            replacedert.IsTrue(originalPosition.Y < session.Manage().Window.Position.Y);

            // Restore application window original position
            session.Manage().Window.Position = originalPosition;
            replacedert.AreEqual(originalPosition, session.Manage().Window.Position);
        }

19 View Source File : Orientation.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetOrientationError_NoSuchWindow()
        {
            try
            {
                var orientation = Utility.GetOrphanedSession().Orientation;
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

public static void ClearEditBox()
        {
            // Select all text and delete using keyboard shortcut Ctrl + A and Delete
            editBox.Click();
            session.Keyboard.SendKeys(Keys.Control + "a" + Keys.Control);
            session.Keyboard.SendKeys(Keys.Delete);
            replacedert.AreEqual(string.Empty, editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_EmptySequence()
        {
            session.Keyboard.SendKeys(string.Empty);
            replacedert.AreEqual(string.Empty, editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_ModifierControl()
        {
            session.Keyboard.SendKeys("789");
            session.Keyboard.SendKeys(Keys.Control + "a" + Keys.Control); // Select all
            session.Keyboard.SendKeys(Keys.Control + "c" + Keys.Control); // Copy
            session.Keyboard.SendKeys(Keys.Control + "vvv" + Keys.Control); // Paste 3 times
            replacedert.AreEqual("789789789", editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_NonPrintableKeys()
        {
            session.Keyboard.SendKeys("9");
            session.Keyboard.SendKeys(Keys.Home + "8");
            session.Keyboard.SendKeys(Keys.Home + "7");
            session.Keyboard.SendKeys(Keys.Home + Keys.Tab);
            session.Keyboard.SendKeys(Keys.Home + Keys.Enter);
            session.Keyboard.SendKeys(Keys.Up + Keys.Tab + "78");
            session.Keyboard.SendKeys(Keys.Home + Keys.Enter);
            session.Keyboard.SendKeys(Keys.Up + Keys.Tab + "7");
            replacedert.AreEqual("\t7\r\n\t78\r\n\t789", editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_Number()
        {
            session.Keyboard.SendKeys("0123456789");
            replacedert.AreEqual("0123456789", editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_SymbolsEscapedCharacter()
        {
            // Line endings such as \r or \n are replaced with \r\n
            // form feeds (\f) or vertical tab feeds (\v) are removed
            session.Keyboard.SendKeys("\a\b\f\n\r\t\v\'\"\\\r\n");
            replacedert.AreEqual("\r\n\r\n\t\'\"\\\r\n\r\n", editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeys_SymbolsKeys()
        {
            session.Keyboard.SendKeys("`-=[]\\;',./[email protected]#$%^&*()_+{}|:\"<>?");
            replacedert.AreEqual("`-=[]\\;',./[email protected]#$%^&*()_+{}|:\"<>?", editBox.Text);
        }

19 View Source File : SendKeys.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SendKeysError_NoSuchWindow()
        {
            try
            {
                Utility.GetOrphanedSession().Keyboard.SendKeys("keys");
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : Session.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void MiscellaneousSession_GetSessionCapabilities()
        {
            session = Utility.CreateNewSession(CommonTestSettings.AlarmClockAppId);
            replacedert.IsNotNull(session.SessionId);

            ICapabilities capabilities = session.Capabilities;
            replacedert.AreEqual(CommonTestSettings.AlarmClockAppId, capabilities.GetCapability("app"));
            replacedert.AreEqual("Windows", capabilities.GetCapability("platformName"));
        }

19 View Source File : Title.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Getreplacedle_ClreplacedicApp()
        {
            session = Utility.CreateNewSession(CommonTestSettings.NotepadAppId);
            replacedert.IsNotNull(session);
            replacedert.AreEqual("Unreplacedled - Notepad", session.replacedle);
        }

19 View Source File : Title.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetreplacedleError_NoSuchWindow()
        {
            try
            {
                var replacedle = Utility.GetOrphanedSession().replacedle;
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : TouchClick.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void TouchSingleTap()
        {
            session.FindElementByAccessibilityId("addressEditBox").SendKeys(Keys.Alt + 'd' + Keys.Alt + CommonTestSettings.EdgeAboutFlagsURL + Keys.Enter);
            Thread.Sleep(TimeSpan.FromSeconds(2));
            var originalreplacedle = session.replacedle;
            replacedert.AreNotEqual(string.Empty, originalreplacedle);

            // Navigate to Edge blank page to create navigation history
            session.FindElementByAccessibilityId("addressEditBox").SendKeys(Keys.Alt + 'd' + Keys.Alt + CommonTestSettings.EdgeAboutBlankURL + Keys.Enter);
            Thread.Sleep(TimeSpan.FromSeconds(2));
            replacedert.AreNotEqual(originalreplacedle, session.replacedle);

            // Perform single tap touch on the back button
            touchScreen.SingleTap(session.FindElementByName("Back").Coordinates);
            Thread.Sleep(TimeSpan.FromSeconds(2));

            // Make sure the page you went to is the page we started on
            replacedert.AreEqual(originalreplacedle, session.replacedle);
        }

19 View Source File : TouchClick.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void TouchSingleTapError_StaleElement()
        {
            try
            {
                // Perform single tap touch on stale element
                touchScreen.SingleTap(GetStaleElement().Coordinates);
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.StaleElementReference, exception.Message);
            }
        }

19 View Source File : TouchLongClick.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void TouchLongTap()
        {
            // Create a new test alarm
            string alarmName = "LongTapTest";
            DeletePreviouslyCreatedAlarmEntry(alarmName);
            AddAlarmEntry(alarmName);
            Thread.Sleep(TimeSpan.FromSeconds(3));

            var alarmEntries = session.FindElementsByXPath($"//Lisreplacedem[starts-with(@Name, \"{alarmName}\")]");
            replacedert.IsNotNull(alarmEntries);
            replacedert.AreEqual(1, alarmEntries.Count);

            // Open a the context menu on the alarm entry using long tap (press and hold) action and click delete
            touchScreen.LongPress(alarmEntries[0].Coordinates);
            Thread.Sleep(TimeSpan.FromSeconds(3));
            session.FindElementByName("Delete").Click();
            Thread.Sleep(TimeSpan.FromSeconds(3));

            alarmEntries = session.FindElementsByXPath($"//Lisreplacedem[starts-with(@Name, \"{alarmName}\")]");
            replacedert.IsNotNull(alarmEntries);
            replacedert.AreEqual(0, alarmEntries.Count);
        }

19 View Source File : TouchLongClick.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void TouchLongTapError_StaleElement()
        {
            try
            {
                // Perform long press touch on stale element
                touchScreen.LongPress(GetStaleElement().Coordinates);
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.StaleElementReference, exception.Message);
            }
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void CloseWindowError_NoSuchWindow()
        {
            // Attempt to close the previously closed application window
            try
            {
                Utility.GetOrphanedSession().Close();
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void GetWindowPosition()
        {
            var windowPosition = WindowTransformSession.Manage().Window.Position;
            replacedert.IsNotNull(windowPosition);
            replacedert.AreEqual(OriginalPosition.X, windowPosition.X);
            replacedert.AreEqual(OriginalPosition.Y, windowPosition.Y);
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SetWindowPosition()
        {
            int offset = 100;
            WindowTransformSession.Manage().Window.Position = new Point(OriginalPosition.X + offset, OriginalPosition.Y + offset);
            var windowPosition = WindowTransformSession.Manage().Window.Position;
            replacedert.IsNotNull(windowPosition);
            replacedert.AreEqual(OriginalPosition.X + offset, windowPosition.X);
            replacedert.AreEqual(OriginalPosition.Y + offset, windowPosition.Y);
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SetWindowPosition_ToOrigin()
        {
            var origin = new Point(0, 0);
            WindowTransformSession.Manage().Window.Position = origin;
            var position = WindowTransformSession.Manage().Window.Position;
            replacedert.AreEqual(origin.X, position.X);
            replacedert.AreEqual(origin.Y, position.Y);
        }

19 View Source File : Window.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void SetWindowPositionError_NoSuchWindow()
        {
            try
            {
                Utility.GetOrphanedSession().Manage().Window.Position = new Point(0, 0);
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(ErrorStrings.NoSuchWindow, exception.Message);
            }
        }

19 View Source File : SimpleAttributeExpression.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void InvalidAttributeValue()
        {
            try
            {
                // [@Name=\"St^*~art\"]
                var xpath = "/Pane[@ClreplacedName=\"#32769\"][@Name=\"Desktop 1\"]/Pane[@ClreplacedName=\"Shell_TrayWnd\"][@Name=\"Taskbar\"]/Button[@ClreplacedName=\"Start\"][@Name=\"St^*~art\"]";
                desktopSession.DesktopSessionElement.FindElementByXPath(xpath);
                replacedert.Fail("Exception should have been thrown");
            }
            catch (InvalidOperationException exception)
            {
                replacedert.AreEqual(WebDriverAPI.ErrorStrings.NoSuchElement, exception.Message);
            }
        }

19 View Source File : TouchScenarios.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod, TestCategory("SingleTouch")]
        public void RightTapped()
        {
            var touchable = AppSession.FindElementByAccessibilityId("Touchable");
            TouchScreen.LongPress(touchable.Coordinates);
            replacedert.AreEqual("RightTapped", _GetLastResultString());
        }

19 View Source File : Button.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Name()
        {
            replacedert.AreEqual("ControlType.Button", buttonElement.TagName);
        }

19 View Source File : CheckBox.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Click()
        {
            var checkBoxEventOutput = session.FindElementByAccessibilityId("Control2Output");
            replacedert.AreEqual(string.Empty, checkBoxEventOutput.Text);

            checkBoxElement2.Click();
            replacedert.AreEqual("CheckBox is checked.", checkBoxEventOutput.Text);

            checkBoxElement2.Click();
            replacedert.AreEqual("CheckBox state is indeterminate.", checkBoxEventOutput.Text);

            checkBoxElement2.Click();
            replacedert.AreEqual("CheckBox is unchecked.", checkBoxEventOutput.Text);
        }

19 View Source File : RadioButton.cs
License : MIT License
Project Creator : kfrajtak

[TestMethod]
        public void Click()
        {
            var radioButtonEventOutput = session.FindElementByAccessibilityId("Control1Output");

            radioButtonElement1.Click();
            replacedert.AreEqual("You selected option 1.", radioButtonEventOutput.Text);

            radioButtonElement2.Click();
            replacedert.AreEqual("You selected option 2.", radioButtonEventOutput.Text);
        }

See More Examples