public void GetDriveByVolumeLabel_Pickup() { var ramdisk = new RamDrive(); var volumeLabel = "Pickup"; var actual = ramdisk.GetDriveByVolumeLabel(volumeLabel); Assert.IsNotNull(actual); }
public void CreateDrive() { char driveLetter = 'y'; int MB = 100; string label = "Pickup"; var actual = RamDrive.CreateDrive(driveLetter, MB, label); Assert.IsTrue(actual); }
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); }
/// <summary> /// Mounts a drive on system memory and creates SQL database there. (drops database if exists first) /// </summary> /// <param name="connectionString">Connection string to SQL database</param> /// <param name="sizeMegaByte">Size of ram drive in mega bytes</param> /// <param name="drive"></param> /// <returns></returns> public static IDisposable Create(string connectionString, int sizeMegaByte = 256, char drive = 'Z') { if (string.IsNullOrWhiteSpace(connectionString)) { throw new ArgumentNullException(nameof(connectionString)); } RamDrive.Mount(sizeMegaByte, RamDisk.FileSystem.NTFS, drive, "SqlInMemory"); SqlHelper.DropDatabaseAndRecreate(connectionString, null, $"{drive}:\\", force: true); return(new Releaser(connectionString, drive)); }
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 UpdatePermissionsDbTest(ITestOutputHelper output, CustomWebApplicationFactory factory, RamDrive ramDrive) : base(output, factory, ramDrive) { }
public DbTestBase(ITestOutputHelper output, CustomWebApplicationFactory factory, RamDrive ramDrive) { OutputWriter = output; if (!ramDrive.Ready) { throw new Exception($"Ramdrive not ready!: {ramDrive.Error}"); } OutputWriter.WriteLine(ramDrive.Output.ToString()); WebApplicationFactory <TestStartup> webFactory = factory.WithWebHostBuilder(builder => { builder.UseSolutionRelativeContentRoot("BeepBackend"); builder.ConfigureAppConfiguration((context, configurationBuilder) => { string cfgPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.json"); configurationBuilder.AddJsonFile(cfgPath); }); builder.ConfigureServices(services => { services.AddMvc().AddApplicationPart(typeof(Startup).Assembly); }); }); WebClient = webFactory.CreateClient( new WebApplicationFactoryClientOptions() { BaseAddress = new Uri("http://localhost/api/") }); var scope = factory.Server.Services.CreateScope(); UsrManager = scope.ServiceProvider.GetRequiredService <UserManager <User> >(); DbContext = scope.ServiceProvider.GetRequiredService <BeepDbContext>(); _roleMgr = scope.ServiceProvider.GetRequiredService <RoleManager <Role> >(); }
public void Null_Drive_Label_Should_Throws_ArgumentNullException() { TestDelegate action = () => RamDrive.Mount(128, FileSystem.NTFS, 'X', null); Assert.Throws <ArgumentNullException>(action); }
public void Negative_Drive_Size_Should_Throws_ArgumentException() { TestDelegate action = () => RamDrive.Mount(-128); Assert.Throws <ArgumentException>(action); }
public void Duplicate_Drive_Name_Should_Throws_InvalidOperationException() { TestDelegate action = () => RamDrive.Mount(128, FileSystem.NTFS, 'X', "MyDriveName"); Assert.Throws <InvalidOperationException>(action); }
public void Unmount_NotExists_Drive_Should_Throws_InvalidOperationException() { TestDelegate action = () => RamDrive.Unmount('Q'); Assert.Throws <InvalidOperationException>(action); }
public AuthControllerTests(ITestOutputHelper output, CustomWebApplicationFactory factory, RamDrive ramDrive) : base(output, factory, ramDrive) { }
public ArticlesPermissionsTest(ITestOutputHelper output, CustomWebApplicationFactory factory, RamDrive ramDrive) : base(output, factory, ramDrive) { }
public void Dispose() { SqlHelper.DropDatabase(_connectionString, force: true); RamDrive.Unmount(_drive); }
public ArticleFilteringTests(ITestOutputHelper output, CustomWebApplicationFactory factory, RamDrive ramDrive) : base(output, factory, ramDrive) { }