public void WhenInitialFileSizeIsSetTheFileSizeForDataFileAndScratchFileShouldBeSetAccordinglyAndItWillBeRoundedToTheNearestGranularity() { Win32NativeMethods.SYSTEM_INFO systemInfo; Win32NativeMethods.GetSystemInfo(out systemInfo); var options = StorageEnvironmentOptions.ForPath(path); options.InitialFileSize = systemInfo.allocationGranularity * 2 + 1; using (new StorageEnvironment(options)) { var dataFile = Path.Combine(path, Constants.DatabaseFilename); var scratchFile = Path.Combine(path, "scratch.buffers"); Assert.Equal(systemInfo.allocationGranularity * 3, new FileInfo(dataFile).Length); Assert.Equal(systemInfo.allocationGranularity * 3, new FileInfo(scratchFile).Length); } }
public void WhenInitialFileSizeIsNotSetTheFileSizeForDataFileAndScratchFileShouldBeSetToSystemAllocationGranularity() { Win32NativeMethods.SYSTEM_INFO systemInfo; Win32NativeMethods.GetSystemInfo(out systemInfo); var options = StorageEnvironmentOptions.ForPath(path); options.InitialFileSize = null; using (new StorageEnvironment(options)) { var dataFile = Path.Combine(path, Constants.DatabaseFilename); var scratchFile = Path.Combine(path, StorageEnvironmentOptions.ScratchBufferName(0)); Assert.Equal(systemInfo.allocationGranularity, new FileInfo(dataFile).Length); Assert.Equal(systemInfo.allocationGranularity, new FileInfo(scratchFile).Length); } }