Ejemplo n.º 1
0
        public void Test_GetAbsolutePath()
        {
            FilePathRelative      filePathTo;
            DirectoryPathAbsolute directoryPathFrom;

            filePathTo        = new FilePathRelative(@"..\File.txt");
            directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
            Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\File.txt");
            Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

            filePathTo        = new FilePathRelative(@".\File.txt");
            directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
            Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\File.txt");
            Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

            filePathTo        = new FilePathRelative(@"..\Dir2\File.txt");
            directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
            Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir2\File.txt");
            Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

            filePathTo        = new FilePathRelative(@"..\..\Dir4\Dir5\File.txt");
            directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir3");
            Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\Dir4\Dir5\File.txt");
            Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

            filePathTo        = new FilePathRelative(@".\..\Dir4\Dir5\File.txt");
            directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir3");
            Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\Dir2\Dir4\Dir5\File.txt");
            Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));
        }
Ejemplo n.º 2
0
        public void Test_GetAbsolutePathPathWithError6()
        {
            FilePathRelative directoryPathTo = new FilePathRelative(@"..\..\Dir1\File.txt");

            Assert.IsFalse(directoryPathTo.CanGetAbsolutePathFrom(null));
            directoryPathTo.GetAbsolutePathFrom(null);
        }
Ejemplo n.º 3
0
        public void Test_GetAbsolutePathPathWithError5()
        {
            FilePathRelative      directoryPathTo   = new FilePathRelative(@"..\..\Dir1\File.txt");
            DirectoryPathAbsolute directoryPathFrom = DirectoryPathAbsolute.Empty;

            Assert.IsFalse(directoryPathTo.CanGetAbsolutePathFrom(directoryPathFrom));
            directoryPathTo.GetAbsolutePathFrom(directoryPathFrom);
        }
Ejemplo n.º 4
0
        public void Test_GetAbsolutePathPathWithError4()
        {
            FilePathRelative      directoryPathTo   = FilePathRelative.Empty;
            DirectoryPathAbsolute directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");

            Assert.IsFalse(directoryPathTo.CanGetAbsolutePathFrom(directoryPathFrom));
            directoryPathTo.GetAbsolutePathFrom(directoryPathFrom);
        }
Ejemplo n.º 5
0
 public void Test_GetAbsolutePathPathWithError6()
 {
     FilePathRelative directoryPathTo = new FilePathRelative(@"..\..\Dir1\File.txt");
      Assert.IsFalse(directoryPathTo.CanGetAbsolutePathFrom(null));
      directoryPathTo.GetAbsolutePathFrom(null);
 }
Ejemplo n.º 6
0
 public void Test_GetAbsolutePathPathWithError5()
 {
     FilePathRelative directoryPathTo = new FilePathRelative(@"..\..\Dir1\File.txt");
      DirectoryPathAbsolute directoryPathFrom = DirectoryPathAbsolute.Empty;
      Assert.IsFalse(directoryPathTo.CanGetAbsolutePathFrom(directoryPathFrom));
      directoryPathTo.GetAbsolutePathFrom(directoryPathFrom);
 }
Ejemplo n.º 7
0
        public void Test_GetAbsolutePath()
        {
            FilePathRelative filePathTo;
             DirectoryPathAbsolute directoryPathFrom;

             filePathTo = new FilePathRelative(@"..\File.txt");
             directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
             Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\File.txt");
             Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

             filePathTo = new FilePathRelative(@".\File.txt");
             directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
             Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\File.txt");
             Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

             filePathTo = new FilePathRelative(@"..\Dir2\File.txt");
             directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1");
             Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir2\File.txt");
             Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

             filePathTo = new FilePathRelative(@"..\..\Dir4\Dir5\File.txt");
             directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir3");
             Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\Dir4\Dir5\File.txt");
             Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));

             filePathTo = new FilePathRelative(@".\..\Dir4\Dir5\File.txt");
             directoryPathFrom = new DirectoryPathAbsolute(@"C:\Dir1\Dir2\Dir3");
             Assert.IsTrue(filePathTo.GetAbsolutePathFrom(directoryPathFrom).Path == @"C:\Dir1\Dir2\Dir4\Dir5\File.txt");
             Assert.IsTrue(filePathTo.CanGetAbsolutePathFrom(directoryPathFrom));
        }