Ejemplo n.º 1
0
        public void UnionBothNull()
        {
            var fisU = File.Union(null, null);

            Assert.IsInstanceOf <List <FileInfo> >(fisU);
            Assert.AreEqual(0, fisU.Count);
        }
Ejemplo n.º 2
0
        public void RemoveDuplicateUnion()
        {
            var fisA = new List <FileInfo>
            {
                new FileInfo("z:\\a.txt")
            };
            var fisB = new List <FileInfo>
            {
                new FileInfo("z:\\a.txt"),
                new FileInfo("z:\\b.txt")
            };

            var fisU = File.Union(fisA, fisB);

            Assert.AreEqual(2, fisU.Count);
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\b.txt"));

            // nothing has changed
            Assert.AreEqual(1, fisA.Count);
            Assert.IsTrue(fisA.Any(f => f.FullName == "z:\\a.txt"));

            Assert.AreEqual(2, fisB.Count);
            Assert.IsTrue(fisB.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fisB.Any(f => f.FullName == "z:\\b.txt"));
        }
Ejemplo n.º 3
0
        public void UnionSecondListIsNullList()
        {
            var fis = new List <FileInfo>
            {
                new FileInfo("z:\\a.txt"),
                new FileInfo("z:\\b.txt")
            };

            var fisU = File.Union(fis, null);

            Assert.AreEqual(2, fisU.Count);
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\b.txt"));

            Assert.AreEqual(2, fis.Count);
            Assert.IsTrue(fis.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fis.Any(f => f.FullName == "z:\\b.txt"));
        }
Ejemplo n.º 4
0
        public void UnionSecondListIsEmpty()
        {
            var fisA = new List <FileInfo>
            {
                new FileInfo("z:\\a.txt"),
                new FileInfo("z:\\b.txt")
            };
            var fisB = new List <FileInfo>();

            var fisU = File.Union(fisA, fisB);

            Assert.AreEqual(2, fisU.Count);
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fisU.Any(f => f.FullName == "z:\\b.txt"));

            // nothing has changed
            Assert.AreEqual(2, fisA.Count);
            Assert.IsTrue(fisA.Any(f => f.FullName == "z:\\a.txt"));
            Assert.IsTrue(fisA.Any(f => f.FullName == "z:\\b.txt"));

            Assert.AreEqual(0, fisB.Count);
        }