public void OneTimeSetUp() { try { RamDrive.Unmount('X'); } catch { } try { RamDrive.Unmount('Y'); } catch { } TestDelegate action = () => RamDrive.Mount(128, FileSystem.NTFS, 'X', "MyDriveName"); Assert.DoesNotThrow(action); Drive = DriveInfo.GetDrives().FirstOrDefault(d => d.Name.ToUpper()[0] == 'X'); }
public void OneTimeTearDown() { try { RamDrive.Unmount('Y'); } catch { } TestDelegate action = () => RamDrive.Unmount('X'); Assert.DoesNotThrow(action); var exists = DriveInfo.GetDrives().Any(d => d.Name.ToUpper()[0] == 'X'); Assert.IsFalse(exists); }
public void Another_Drive_Format_Should_Work_Correctly(FileSystem fileSystem) { TestDelegate action = () => RamDrive.Mount(128, fileSystem, 'Y', "RamDisk"); Assert.DoesNotThrow(action); var drive = DriveInfo.GetDrives().FirstOrDefault(d => d.Name.ToUpper()[0] == 'Y'); Assert.IsNotNull(drive); Assert.AreEqual(drive.DriveFormat, fileSystem.ToString()); TestDelegate action2 = () => RamDrive.Unmount('Y'); Assert.DoesNotThrow(action2); Thread.Sleep(100); var exists = DriveInfo.GetDrives().Any(d => d.Name.ToUpper()[0] == 'Y'); Assert.IsFalse(exists); }
public void Unmount_NotExists_Drive_Should_Throws_InvalidOperationException() { TestDelegate action = () => RamDrive.Unmount('Q'); Assert.Throws <InvalidOperationException>(action); }
public void Dispose() { SqlHelper.DropDatabase(_connectionString, force: true); RamDrive.Unmount(_drive); }