Ejemplo n.º 1
0
        public void Test_PathEquality()
        {
            //
            // filePathRelative
            //
            FilePathRelative filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
            FilePathRelative filePathRelative2 = new FilePathRelative(@"..\\dir1//file.TXT");

            Assert.IsTrue(filePathRelative1.Equals(filePathRelative2));
            Assert.IsTrue(filePathRelative1 == filePathRelative2);

            filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
            filePathRelative2 = new FilePathRelative(@".\Dir1\File.txt");
            Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
            Assert.IsFalse(filePathRelative1 == filePathRelative2);

            filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
            filePathRelative2 = new FilePathRelative(@"..\Dir1\Dir2\File.txt");
            Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
            Assert.IsFalse(filePathRelative1 == filePathRelative2);

            filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
            filePathRelative2 = new FilePathRelative(@"..\Dir1\File.tx");
            Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
            Assert.IsFalse(filePathRelative1 == filePathRelative2);

            //
            // filePathAbsolute
            //
            FilePathAbsolute filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
            FilePathAbsolute filePathAbsolute2 = new FilePathAbsolute(@"C:\\dir1//file.TXT");

            Assert.IsTrue(filePathAbsolute1.Equals(filePathAbsolute2));
            Assert.IsTrue(filePathAbsolute1 == filePathAbsolute2);

            filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
            filePathAbsolute2 = new FilePathAbsolute(@"D:\Dir1\File.txt");
            Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
            Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

            filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
            filePathAbsolute2 = new FilePathAbsolute(@"C:\Dir1\Dir2\File.txt");
            Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
            Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

            filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
            filePathAbsolute2 = new FilePathAbsolute(@"C:\Dir1\File.tx");
            Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
            Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

            //
            // Mix between filePathAbsolute and filePathRelative
            //
            filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
            filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
            Assert.IsFalse(filePathAbsolute1.Equals(filePathRelative1));
            Assert.IsFalse(filePathAbsolute1 == filePathRelative1);

            //
            // Mix between directoryPath and filePath
            //
            DirectoryPathAbsolute directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\File");

            filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File");
            Assert.IsFalse(directoryPathAbsolute1.Equals(filePathAbsolute1));
            Assert.IsFalse(filePathAbsolute1.Equals(directoryPathAbsolute1));
            Assert.IsFalse(filePathAbsolute1 == directoryPathAbsolute1);

            DirectoryPathRelative directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\File");

            filePathRelative1 = new FilePathRelative(@"..\Dir1\File");
            Assert.IsFalse(directoryPathRelative1.Equals(filePathRelative1));
            Assert.IsFalse(filePathRelative1.Equals(directoryPathRelative1));
            Assert.IsFalse(filePathRelative1 == directoryPathRelative1);
        }
Ejemplo n.º 2
0
        public void Test_PathEquality()
        {
            Assert.IsFalse(DirectoryPathAbsolute.Empty.Equals(null));
             Assert.IsFalse(DirectoryPathAbsolute.Empty == null);

             Assert.IsTrue(DirectoryPathAbsolute.Empty.Equals(DirectoryPathRelative.Empty));
             Assert.IsTrue(DirectoryPathAbsolute.Empty == DirectoryPathRelative.Empty);

             Assert.IsFalse(DirectoryPathAbsolute.Empty.Equals(new DirectoryPathRelative(@"..\Dir1\Dir2")));
             Assert.IsFalse(DirectoryPathAbsolute.Empty == new DirectoryPathRelative(@"..\Dir1\Dir2"));

             //
             // directoryPathRelative
             //
             DirectoryPathRelative directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
             DirectoryPathRelative directoryPathRelative2 = new DirectoryPathRelative(@"..\\dir1//DIR2/");
             Assert.IsTrue(directoryPathRelative1.Equals(directoryPathRelative2));
             Assert.IsTrue(directoryPathRelative1 == directoryPathRelative2);

             directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
             directoryPathRelative2 = new DirectoryPathRelative(@".\Dir1\Dir2");
             Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
             Assert.IsFalse(directoryPathRelative1 == directoryPathRelative2);

             directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
             directoryPathRelative2 = new DirectoryPathRelative(@"..\Dir1\Dir2\Dir3");
             Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
             Assert.IsTrue(directoryPathRelative1 != directoryPathRelative2);

             directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
             directoryPathRelative2 = new DirectoryPathRelative(@"..\Dir1\Dir");
             Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
             Assert.IsTrue(directoryPathRelative1 != directoryPathRelative2);

             //
             // directoryPathAbsolute
             //
             DirectoryPathAbsolute directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
             DirectoryPathAbsolute directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\\dir1//Dir2\\");
             Assert.IsTrue(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
             Assert.IsFalse(directoryPathAbsolute1 != directoryPathAbsolute2);

             directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
             directoryPathAbsolute2 = new DirectoryPathAbsolute(@"D:\Dir1\Dir2");
             Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
             Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

             directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
             directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir2");
             Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
             Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

             directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
             directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\Dir1\Dir");
             Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
             Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

             //
             // Mix between directoryPathAbsolute and directoryPathRelative
             //
             directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
             directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
             Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathRelative1));
             Assert.IsFalse(directoryPathAbsolute1 == directoryPathRelative1);
        }
Ejemplo n.º 3
0
        public void Test_PathEquality()
        {
            Assert.IsFalse(DirectoryPathAbsolute.Empty.Equals(null));
            Assert.IsFalse(DirectoryPathAbsolute.Empty == null);

            Assert.IsTrue(DirectoryPathAbsolute.Empty.Equals(DirectoryPathRelative.Empty));
            Assert.IsTrue(DirectoryPathAbsolute.Empty == DirectoryPathRelative.Empty);

            Assert.IsFalse(DirectoryPathAbsolute.Empty.Equals(new DirectoryPathRelative(@"..\Dir1\Dir2")));
            Assert.IsFalse(DirectoryPathAbsolute.Empty == new DirectoryPathRelative(@"..\Dir1\Dir2"));

            //
            // directoryPathRelative
            //
            DirectoryPathRelative directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
            DirectoryPathRelative directoryPathRelative2 = new DirectoryPathRelative(@"..\\dir1//DIR2/");

            Assert.IsTrue(directoryPathRelative1.Equals(directoryPathRelative2));
            Assert.IsTrue(directoryPathRelative1 == directoryPathRelative2);

            directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
            directoryPathRelative2 = new DirectoryPathRelative(@".\Dir1\Dir2");
            Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
            Assert.IsFalse(directoryPathRelative1 == directoryPathRelative2);

            directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
            directoryPathRelative2 = new DirectoryPathRelative(@"..\Dir1\Dir2\Dir3");
            Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
            Assert.IsTrue(directoryPathRelative1 != directoryPathRelative2);

            directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
            directoryPathRelative2 = new DirectoryPathRelative(@"..\Dir1\Dir");
            Assert.IsFalse(directoryPathRelative1.Equals(directoryPathRelative2));
            Assert.IsTrue(directoryPathRelative1 != directoryPathRelative2);

            //
            // directoryPathAbsolute
            //
            DirectoryPathAbsolute directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
            DirectoryPathAbsolute directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\\dir1//Dir2\\");

            Assert.IsTrue(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
            Assert.IsFalse(directoryPathAbsolute1 != directoryPathAbsolute2);

            directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
            directoryPathAbsolute2 = new DirectoryPathAbsolute(@"D:\Dir1\Dir2");
            Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
            Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

            directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
            directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir2");
            Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
            Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

            directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
            directoryPathAbsolute2 = new DirectoryPathAbsolute(@"C:\Dir1\Dir");
            Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathAbsolute2));
            Assert.IsFalse(directoryPathAbsolute1 == directoryPathAbsolute2);

            //
            // Mix between directoryPathAbsolute and directoryPathRelative
            //
            directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\Dir2");
            directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\Dir2");
            Assert.IsFalse(directoryPathAbsolute1.Equals(directoryPathRelative1));
            Assert.IsFalse(directoryPathAbsolute1 == directoryPathRelative1);
        }
Ejemplo n.º 4
0
        public void Test_PathEquality()
        {
            //
             // filePathRelative
             //
             FilePathRelative filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
             FilePathRelative filePathRelative2 = new FilePathRelative(@"..\\dir1//file.TXT");
             Assert.IsTrue(filePathRelative1.Equals(filePathRelative2));
             Assert.IsTrue(filePathRelative1 == filePathRelative2);

             filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
             filePathRelative2 = new FilePathRelative(@".\Dir1\File.txt");
             Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
             Assert.IsFalse(filePathRelative1 == filePathRelative2);

             filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
             filePathRelative2 = new FilePathRelative(@"..\Dir1\Dir2\File.txt");
             Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
             Assert.IsFalse(filePathRelative1 == filePathRelative2);

             filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
             filePathRelative2 = new FilePathRelative(@"..\Dir1\File.tx");
             Assert.IsFalse(filePathRelative1.Equals(filePathRelative2));
             Assert.IsFalse(filePathRelative1 == filePathRelative2);

             //
             // filePathAbsolute
             //
             FilePathAbsolute filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
             FilePathAbsolute filePathAbsolute2 = new FilePathAbsolute(@"C:\\dir1//file.TXT");
             Assert.IsTrue(filePathAbsolute1.Equals(filePathAbsolute2));
             Assert.IsTrue(filePathAbsolute1 == filePathAbsolute2);

             filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
             filePathAbsolute2 = new FilePathAbsolute(@"D:\Dir1\File.txt");
             Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
             Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

             filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
             filePathAbsolute2 = new FilePathAbsolute(@"C:\Dir1\Dir2\File.txt");
             Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
             Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

             filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
             filePathAbsolute2 = new FilePathAbsolute(@"C:\Dir1\File.tx");
             Assert.IsFalse(filePathAbsolute1.Equals(filePathAbsolute2));
             Assert.IsFalse(filePathAbsolute1 == filePathAbsolute2);

             //
             // Mix between filePathAbsolute and filePathRelative
             //
             filePathRelative1 = new FilePathRelative(@"..\Dir1\File.txt");
             filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File.txt");
             Assert.IsFalse(filePathAbsolute1.Equals(filePathRelative1));
             Assert.IsFalse(filePathAbsolute1 == filePathRelative1);

             //
             // Mix between directoryPath and filePath
             //
             DirectoryPathAbsolute directoryPathAbsolute1 = new DirectoryPathAbsolute(@"C:\Dir1\File");
             filePathAbsolute1 = new FilePathAbsolute(@"C:\Dir1\File");
             Assert.IsFalse(directoryPathAbsolute1.Equals(filePathAbsolute1));
             Assert.IsFalse(filePathAbsolute1.Equals(directoryPathAbsolute1));
             Assert.IsFalse(filePathAbsolute1 == directoryPathAbsolute1);

             DirectoryPathRelative directoryPathRelative1 = new DirectoryPathRelative(@"..\Dir1\File");
             filePathRelative1 = new FilePathRelative(@"..\Dir1\File");
             Assert.IsFalse(directoryPathRelative1.Equals(filePathRelative1));
             Assert.IsFalse(filePathRelative1.Equals(directoryPathRelative1));
             Assert.IsFalse(filePathRelative1 == directoryPathRelative1);
        }