Example #1
0
        public void Full_test()
        {
            var fileList = new PathList <UoeFileToCompile>();

            for (int i = 0; i < 1000; i++)
            {
                fileList.Add(new UoeFileToCompile(i.ToString()));
            }

            var j = 0;

            foreach (var compile in fileList)
            {
                Assert.AreEqual(j.ToString(), compile.Path);
                j++;
            }

            Assert.AreEqual(1000, fileList.Count);

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(i.ToString(), fileList[i.ToString()].Path);
            }

            j = 0;
            foreach (var compile in fileList)
            {
                Assert.AreEqual(j.ToString(), fileList[compile].Path);
                j++;
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.Contains(i.ToString()));
            }

            j = 0;
            foreach (var compile in fileList)
            {
                Assert.AreEqual(true, fileList.Contains(compile));
                j++;
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(false, fileList.TryAdd(new UoeFileToCompile(i.ToString())));
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.Remove(new UoeFileToCompile(i.ToString())));
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.TryAdd(new UoeFileToCompile(i.ToString())));
            }

            fileList.Clear();

            Assert.AreEqual(0, fileList.Count);

            var tempList = new List <UoeFileToCompile>();

            for (int i = 0; i < 1000; i++)
            {
                tempList.Add(new UoeFileToCompile(i.ToString()));
            }
            fileList.AddRange(tempList);

            Assert.AreEqual(1000, fileList.Count);
        }