public void GetFullPath_SendInPath_ReturnsFullPath()
        {
            //Arrange
            MockPath mockPath = new MockPath(new MockFileSystem());

            //Act
            string result = mockPath.GetFullPath(s_testPath);

            //Assert
            Assert.Equal(s_testPath, result);
        }
示例#2
0
        public void GetFullPath_SendInPath_ReturnsFullPath()
        {
            //Arrange
            var mockPath = new MockPath(new MockFileSystem());

            //Act
            var result = mockPath.GetFullPath(TestPath);

            //Assert
            Assert.AreEqual(TestPath, result);
        }
        public void GetFullPath_WithMultipleDirectorySeparators_ShouldReturnTheNormalizedForm()
        {
            //Arrange
            MockFileSystem mockFileSystem = new MockFileSystem();
            MockPath       mockPath       = new MockPath(mockFileSystem);

            //Act
            string actualFullPath = mockPath.GetFullPath(XFS.Path(@"c:\foo\\//bar\file.dat"));

            //Assert
            Assert.Equal(XFS.Path(@"c:\foo\bar\file.dat"), actualFullPath);
        }
        public void GetFullPath_EmptyValue_ShouldThrowArgumentException()
        {
            //Arrange
            MockFileSystem mockFileSystem = new MockFileSystem();
            MockPath       mockPath       = new MockPath(mockFileSystem);

            //Act
            Action action = () => mockPath.GetFullPath(string.Empty);

            //Assert
            Assert.Throws <ArgumentException>(action);
        }
        public void GetFullPath_InvalidUNCPaths_ShouldThrowArgumentException()
        {
            //Arrange
            MockFileSystem mockFileSystem = new MockFileSystem();
            MockPath       mockPath       = new MockPath(mockFileSystem);

            //Act
            Action action = () => mockPath.GetFullPath(XFS.Path(@"\\shareZ"));

            //Assert
            Assert.Throws <ArgumentException>(action);
        }
        public void GetFullPath_RootedPathWithRelativeSegments_ShouldReturnAnRootedAbsolutePath(string rootedPath, string expectedResult)
        {
            //Arrange
            MockFileSystem mockFileSystem = new MockFileSystem();
            MockPath       mockPath       = new MockPath(mockFileSystem);

            //Act
            string actualResult = mockPath.GetFullPath(rootedPath);

            //Assert
            Assert.Equal(expectedResult, actualResult);
        }
示例#7
0
        public void GetFullPath_NullValue_ShouldThrowArgumentNullException()
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            var mockPath       = new MockPath(mockFileSystem);

            //Act
            TestDelegate action = () => mockPath.GetFullPath(null);

            //Assert
            Assert.Throws <ArgumentNullException>(action);
        }
        public void GetFullPath_AbsolutePaths_ShouldReturnThePathWithTheRoot_Or_Unc(string currentDir, string absolutePath, string expectedResult)
        {
            //Arrange
            MockFileSystem mockFileSystem = new MockFileSystem();

            mockFileSystem.Directory.SetCurrentDirectory(currentDir);
            MockPath mockPath = new MockPath(mockFileSystem);

            //Act
            string actualResult = mockPath.GetFullPath(absolutePath);

            //Assert
            Assert.Equal(expectedResult, actualResult);
        }
示例#9
0
        public void GetFullPath_RelativePaths_ShouldReturnTheAbsolutePathWithCurrentDirectory(string currentDir, string relativePath, string expectedResult)
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();

            mockFileSystem.Directory.SetCurrentDirectory(currentDir);
            var mockPath = new MockPath(mockFileSystem);

            //Act
            var actualResult = mockPath.GetFullPath(relativePath);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
示例#10
0
 public override string GetFullPath(string path)
 {
     return(_path.GetFullPath(path));
 }
        public void GetFullPath_SendInPath_ReturnsFullPath()
        {
            //Arrange
            var mockPath = new MockPath(new MockFileSystem());

            //Act
            var result = mockPath.GetFullPath(TestPath);

            //Assert
            Assert.AreEqual(TestPath, result);
        }
        public void GetFullPath_EmptyValue_ShouldThrowArgumentException()
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            var mockPath = new MockPath(mockFileSystem);

            //Act
            TestDelegate action = () => mockPath.GetFullPath(string.Empty);

            //Assert
            Assert.Throws<ArgumentException>(action);
        }
        public void GetFullPath_InvalidUNCPaths_ShouldThrowArgumentException()
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            var mockPath = new MockPath(mockFileSystem);

            //Act
            TestDelegate action = () => mockPath.GetFullPath(XFS.Path(@"\\shareZ"));

            //Assert
            Assert.Throws<ArgumentException>(action);
        }
        public void GetFullPath_AbsolutePaths_ShouldReturnThePathWithTheRoot_Or_Unc(string currentDir, string absolutePath, string expectedResult)
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            mockFileSystem.Directory.SetCurrentDirectory(currentDir);
            var mockPath = new MockPath(mockFileSystem);

            //Act
            var actualResult = mockPath.GetFullPath(absolutePath);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
        public void GetFullPath_RootedPathWithRelativeSegments_ShouldReturnAnRootedAbsolutePath(string rootedPath, string expectedResult)
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            var mockPath = new MockPath(mockFileSystem);

            //Act
            var actualResult = mockPath.GetFullPath(rootedPath);

            //Assert
            Assert.AreEqual(expectedResult, actualResult);
        }
        public void GetFullPath_WithMultipleDirectorySeparators_ShouldReturnTheNormalizedForm()
        {
            //Arrange
            var mockFileSystem = new MockFileSystem();
            var mockPath = new MockPath(mockFileSystem);

            //Act
            var actualFullPath =  mockPath.GetFullPath(XFS.Path(@"c:\foo\\//bar\file.dat"));

            //Assert
            Assert.AreEqual(XFS.Path(@"c:\foo\bar\file.dat"), actualFullPath);
        }