예제 #1
0
        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');
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void Unmount_NotExists_Drive_Should_Throws_InvalidOperationException()
        {
            TestDelegate action = () => RamDrive.Unmount('Q');

            Assert.Throws <InvalidOperationException>(action);
        }
예제 #5
0
 public void Dispose()
 {
     SqlHelper.DropDatabase(_connectionString, force: true);
     RamDrive.Unmount(_drive);
 }