Esempio n. 1
0
        public void GetTempPath_Called_WithNullOrEmptyVirtualTempDirectory_ReturnsFallbackTempDirectory(string tempDirectory)
        {
            //Arrange
            var mockPath = new MockPath(new MockFileSystem(), tempDirectory);

            //Act
            var result = mockPath.GetTempPath();

            //Assert
            Assert.IsTrue(result.Length > 0);
        }
        public void GetTempPath_Called_ReturnsStringLengthGreaterThanZero()
        {
            //Arrange
            MockPath mockPath = new MockPath(new MockFileSystem());

            //Act
            string result = mockPath.GetTempPath();

            //Assert
            Assert.True(result.Length > 0);
        }
Esempio n. 3
0
        public void GetTempPath_Called_ReturnsStringLengthGreaterThanZero(string tempDirectory)
        {
            //Arrange
            var mockPath = new MockPath(new MockFileSystem(), string.IsNullOrEmpty(tempDirectory)? tempDirectory: XFS.Path(tempDirectory));

            //Act
            var result = mockPath.GetTempPath();

            //Assert
            Assert.IsTrue(result.Length > 0);
        }
Esempio n. 4
0
        public void GetTempPath_Called_WithNonNullVirtualTempDirectory_ReturnsVirtualTempDirectory()
        {
            //Arrange
            var tempDirectory = XFS.Path(@"C:\temp");

            var mockPath = new MockPath(new MockFileSystem(), tempDirectory);

            //Act
            var result = mockPath.GetTempPath();

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

            //Act
            var result = mockPath.GetTempPath();

            //Assert
            Assert.IsTrue(result.Length > 0);
        }
        public void GetTempFileName_Called_CreatesEmptyFileInTempDirectory()
        {
            //Arrange
            var fileSystem = new MockFileSystem();
            var mockPath = new MockPath(fileSystem);

            //Creating directory explicitly because in normal system Tempory path always exist.
            fileSystem.Directory.CreateDirectory(mockPath.GetTempPath());

            //Act
            var result = mockPath.GetTempFileName();

            Assert.True(fileSystem.FileExists(result));
            Assert.AreEqual(0, fileSystem.FileInfo.FromFileName(result).Length);
        }
        public void GetTempFileName_Called_ReturnsStringLengthGreaterThanZero()
        {
            //Arrange
            var fileSystem = new MockFileSystem();
            var mockPath = new MockPath(fileSystem);

            //Creating directory explicitly because in normal system Tempory path always exist.
            fileSystem.Directory.CreateDirectory(mockPath.GetTempPath());

            //Act
            var result = mockPath.GetTempFileName();

            //Assert
            Assert.IsTrue(result.Length > 0);
        }