예제 #1
0
        public void ApplyPathTransformation()
        {
            var fileList = new PathList <UoeFileToCompile>();

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

            Assert.AreEqual(1000, fileList.Count);

            Assert.IsTrue(fileList.ToList().Exists(f => f.Path.Equals("0")));

            fileList.ApplyPathTransformation(k => {
                k.Path = $"fu{k.Path}";
                return(k);
            });

            Assert.AreEqual(1000, fileList.Count, "wrong count");

            Assert.IsTrue(fileList.ToList().Exists(f => f.Path.Equals("fu0")), "can't find fu0");

            fileList.ApplyPathTransformation(k => {
                k.Path = "no";
                return(k);
            });

            Assert.AreEqual(1, fileList.Count, "should find only 1 because they all have the same key");

            Assert.IsTrue(fileList.ToList().Exists(f => f.Path.Equals("no")), "can't find no");
        }