public void ListOfStringsComparerTest()
        {
            StringBuilder results      = new StringBuilder();
            List <string> expectedList = new List <string>();
            List <string> actualList   = new List <string>();

            expectedList.Add("Maine");
            expectedList.Add("Massachusetts");
            expectedList.Add("New Hampshire");
            expectedList.Add("Connecticut");
            expectedList.Add("Rhode Island");
            expectedList.Add("Vermont");

            actualList.Add("Massachusetts");
            actualList.Add("Connecticut");
            actualList.Add("Rhode Island");
            actualList.Add("Vermont");
            actualList.Add("Maine");
            actualList.Add("New Hampshire");

            ListProcessor.ListOfStringsComparer(expectedList, actualList, results);

            if (results.Length > 0)
            {
                Assert.Fail("{0}{1}", results.ToString(), Environment.NewLine);
            }
        }
        public void ListOfStringsComparerUnequalLengths()
        {
            StringBuilder results      = new StringBuilder();
            List <string> expectedList = new List <string>();
            List <string> actualList   = new List <string>();

            expectedList.Add("A");
            expectedList.Add("B");

            actualList.Add("A");
            bool isEqual = ListProcessor.ListOfStringsComparer(expectedList, actualList, results, true);

            Assert.IsTrue(results.ToString().Contains("The following lists are not the same size:"));
            Assert.IsFalse(isEqual);
        }
        public void ListOfStringsComparerItemNotMatching()
        {
            StringBuilder results      = new StringBuilder();
            List <string> expectedList = new List <string>();
            List <string> actualList   = new List <string>();

            expectedList.Add("A");
            expectedList.Add("B");

            actualList.Add("A");
            actualList.Add("C");
            bool isEqual = ListProcessor.ListOfStringsComparer(expectedList, actualList, results, true);

            Assert.IsTrue(results.ToString().Contains("Expected [C] but found [B]"));
            Assert.IsFalse(isEqual);
        }
        public void ListOfStringsComparerItemNotFound()
        {
            StringBuilder results      = new StringBuilder();
            List <string> expectedList = new List <string>();
            List <string> actualList   = new List <string>();

            expectedList.Add("A");
            expectedList.Add("B");

            actualList.Add("A");
            actualList.Add("C");
            bool isEqual = ListProcessor.ListOfStringsComparer(expectedList, actualList, results, false);

            Assert.IsTrue(results.ToString().Contains("[C] was not found in the list but was expected"));
            Assert.IsFalse(isEqual);
        }
Beispiel #5
0
        public void SelectMultipleItemsFromListBoxTest()
        {
            StringBuilder results       = new StringBuilder();
            List <string> itemsToSelect = new List <string>();

            itemsToSelect.Add("Monitor");
            itemsToSelect.Add("Hard Drive");
            itemsToSelect.Add("Keyboard");
            this.NavigateToUrl();
            this.WebDriver.SelectMultipleElementsFromListBox(computerPartsList, itemsToSelect);
            List <string> selectedItems = this.WebDriver.GetSelectedOptionsFromDropdown(computerPartsList);

            ListProcessor.ListOfStringsComparer(itemsToSelect, selectedItems, results);
            if (results.Length > 0)
            {
                Assert.Fail(results.ToString());
            }
        }
Beispiel #6
0
        public void SelectMultipleItemsFromListBoxTestWithElement()
        {
            StringBuilder results = new StringBuilder();

            List <string> itemsToSelect = new List <string>
            {
                "Monitor",
                "Hard Drive",
                "Keyboard"
            };

            NavigateToUrl();
            var element = this.WebDriver.Wait().ForClickableElement(computerPartsList);

            element.SelectMultipleElementsFromListBox(itemsToSelect);
            List <string> selectedItems = WebDriver.GetSelectedOptionsFromDropdown(computerPartsList);

            ListProcessor.ListOfStringsComparer(itemsToSelect, selectedItems, results);
            if (results.Length > 0)
            {
                Assert.Fail(results.ToString());
            }
        }