コード例 #1
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #8
0
        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));
 }
コード例 #11
0
        public void GetFullPath_SendInPath_ReturnsFullPath()
        {
            //Arrange
            var mockPath = new MockPath(new MockFileSystem());

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

            //Assert
            Assert.AreEqual(TestPath, result);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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);
        }