Example #1
0
        public void MockDriveInfo_ToString_ShouldReturnTheDrivePath(string path, string expectedPath)
        {
            // Arrange
            var directoryPath = XFS.Path(path);

            // Act
            var mockDriveInfo = new MockDriveInfo(new MockFileSystem(), directoryPath);

            // Assert
            Assert.AreEqual(expectedPath, mockDriveInfo.ToString());
        }
Example #2
0
        public void MockDriveInfo_Constructor_ShouldInitializeLocalWindowsDrives_SpecialForWindows()
        {
            // Arrange
            var fileSystem = new MockFileSystem();

            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));

            // Act
            var driveInfo = new MockDriveInfo(fileSystem, "c");

            // Assert
            Assert.AreEqual(@"C:\", driveInfo.Name);
        }
        public void MockDriveInfo_Constructor_ShouldInitializeLocalWindowsDrives(string driveName)
        {
            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));
            var path = XFS.Path(driveName);

            // Act
            var driveInfo = new MockDriveInfo(fileSystem, path);

            // Assert
            Assert.AreEqual(@"C:\", driveInfo.Name);
        }
        public void MockDriveInfo_Constructor_ShouldInitializeLocalWindowsDrives(string driveName)
        {
            // Arrange
            var fileSystem = new MockFileSystem();

            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));
            var path = XFS.Path(driveName);

            // Act
            var driveInfo = new MockDriveInfo(fileSystem, path);

            // Assert
            Assert.Equal(@"C:\", driveInfo.Name);
        }
        public void MockDriveInfo_RootDirectory_ShouldReturnTheDirectoryBase()
        {
            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));
            var driveInfo = new MockDriveInfo(fileSystem, "c:");
            var expectedDirectory = XFS.Path(@"C:\");

            // Act
            var actualDirectory = driveInfo.RootDirectory;

            // Assert
            Assert.AreEqual(expectedDirectory, actualDirectory.FullName);
        }
        public void MockDriveInfo_RootDirectory_ShouldReturnTheDirectoryBase()
        {
            // Arrange
            var fileSystem = new MockFileSystem();

            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));
            var driveInfo         = new MockDriveInfo(fileSystem, "c:");
            var expectedDirectory = XFS.Path(@"C:\");

            // Act
            var actualDirectory = driveInfo.RootDirectory;

            // Assert
            Assert.Equal(expectedDirectory, actualDirectory.FullName);
        }
        public void MockDriveInfo_Constructor_ShouldInitializeLocalWindowsDrives_SpecialForWindows()
        {
            if (XFS.IsUnixPlatform())
            {
                Assert.Inconclusive("Using XFS.Path transform c into c:.");
            }

            // Arrange
            var fileSystem = new MockFileSystem();
            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));

            // Act
            var driveInfo = new MockDriveInfo(fileSystem, "c");

            // Assert
            Assert.AreEqual(@"C:\", driveInfo.Name);
        }
        public void MockDriveInfo_Constructor_ShouldInitializeLocalWindowsDrives_SpecialForWindows()
        {
            if (XFS.IsUnixPlatform())
            {
                Assert.Inconclusive("Using XFS.Path transform c into c:.");
            }

            // Arrange
            var fileSystem = new MockFileSystem();

            fileSystem.AddDirectory(XFS.Path(@"c:\Test"));

            // Act
            var driveInfo = new MockDriveInfo(fileSystem, "c");

            // Assert
            Assert.AreEqual(@"C:\", driveInfo.Name);
        }