public void ConvertToUniqueList_Of_String_Of_Null_Returns_Empty_List()
        {
            IList <string> uniqueList = new List <string>();

            ListLibrary.ConvertToUniqueList(null);

            Assert.IsEmpty(uniqueList);
        }
        public void ConvertToUniqueList_Of_Integer_Of_Unique_List_Returns_Original_List()
        {
            Collection <int> originalList = new Collection <int>()
            {
                1, 55, 25, 999, -1, 3
            };
            IList <int> uniqueList = new List <int>(ListLibrary.ConvertToUniqueList(originalList));
            List <int>  resultList = new List <int> {
                1, 55, 25, 999, -1, 3
            };

            Assert.IsTrue(uniqueList.Count == originalList.Count);
            Assert.AreEqual(resultList[0], uniqueList[0]);
            Assert.AreEqual(resultList[1], uniqueList[1]);
            Assert.AreEqual(resultList[2], uniqueList[2]);
            Assert.AreEqual(resultList[3], uniqueList[3]);
        }
        public void ConvertToUniqueList_Of_Integer_Of_Non_Unique_List_of_Integer_By_Order_Considering_Order_Returns_Unique_List_In_Order()
        {
            Collection <int> nonUniqueList = new Collection <int>()
            {
                1, 55, 25, 999, -1, 3, 55, -1
            };
            IList <int> newList = ListLibrary.ConvertToUniqueList(nonUniqueList, sortList: true);

            List <int> resultList = new List <int> {
                -1, 1, 3, 25, 55, 999
            };

            Assert.IsTrue(nonUniqueList.Count > newList.Count);
            Assert.AreEqual(resultList[0], newList[0]);
            Assert.AreEqual(resultList[1], newList[1]);
            Assert.AreEqual(resultList[2], newList[2]);
            Assert.AreEqual(resultList[3], newList[3]);
        }
        public void ConvertToUniqueList_Of_Integer_Of_Non_Unique_List_Returns_Unique_List()
        {
            Collection <int> nonUniqueList = new Collection <int>()
            {
                1, 55, 25, 999, -1, 3, 55, -1
            };
            List <int> resultList = new List <int> {
                1, 55, 25, 999, -1, 3
            };

            IList <int> unqueList = new List <int>(ListLibrary.ConvertToUniqueList(nonUniqueList));

            Assert.IsTrue(unqueList.Count < nonUniqueList.Count);
            Assert.AreEqual(resultList[0], unqueList[0]);
            Assert.AreEqual(resultList[1], unqueList[1]);
            Assert.AreEqual(resultList[2], unqueList[2]);
            Assert.AreEqual(resultList[3], unqueList[3]);
        }
        public void ConvertToUniqueList_Of_String_Of_Non_Unique_List_of_String_Not_By_Case_Ignoring_Case_Returns_Unique_List()
        {
            Collection <string> nonUniqueList = new Collection <string>()
            {
                "Foo", "Bar", "Moo", "Nar", "bar", "foo", "Fie", "Foo"
            };
            List <string> resultList = new List <string> {
                "Foo", "Bar", "Moo", "Nar"
            };

            List <string> uniqueList = ListLibrary.ConvertToUniqueList(nonUniqueList, caseSensitive: false);

            Assert.IsTrue(resultList.Count < nonUniqueList.Count);
            Assert.AreEqual(resultList[0], uniqueList[0]);
            Assert.AreEqual(resultList[1], uniqueList[1]);
            Assert.AreEqual(resultList[2], uniqueList[2]);
            Assert.AreEqual(resultList[3], uniqueList[3]);
        }
        public void ConvertToUniqueList_Of_String_Of_Non_Unique_List_of_String_By_Case_Considering_Case_Returns_Original_List()
        {
            Collection <string> nonUniqueList = new Collection <string>()
            {
                "Foo", "Bar", "Moo", "Nar", "bar", "foo"
            };
            List <string> resultList = new List <string> {
                "Foo", "Bar", "Moo", "Nar", "bar", "foo"
            };

            List <string> uniqueList = ListLibrary.ConvertToUniqueList(nonUniqueList, caseSensitive: true);

            Assert.IsTrue(resultList.Count == nonUniqueList.Count);
            Assert.AreEqual(resultList[0], uniqueList[0]);
            Assert.AreEqual(resultList[1], uniqueList[1]);
            Assert.AreEqual(resultList[2], uniqueList[2]);
            Assert.AreEqual(resultList[3], uniqueList[3]);
            Assert.AreEqual(resultList[4], uniqueList[4]);
            Assert.AreEqual(resultList[5], uniqueList[5]);
        }
        public void ConvertToUniqueList_Of_Integer_Of_Null_Returns_Empty_List()
        {
            IList <int> newList = new List <int>(ListLibrary.ConvertToUniqueList(null));

            Assert.IsEmpty(newList);
        }