Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 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());
            }
        }
Ejemplo n.º 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());
            }
        }