public void TestNumericKeyWithPartitioning(string directory) { int key1 = 123; int key2 = 1123; var basePath = FileSystemPath.Root.AppendDirectory(directory); var options = new FilesystemStorageOptions() { BasePath = basePath, EntitiesPerDirectory = 1000 }; var expected1 = basePath.AppendDirectory("0") .AppendDirectory(key1.ToString()) .AppendFile(EntityFilename); var actual1 = FilesystemLocator.LocateEntityFile(key1, options); Assert.Equal(expected1, actual1); var expected2 = basePath.AppendDirectory("1") .AppendDirectory(key2.ToString()) .AppendFile(EntityFilename); var actual2 = FilesystemLocator.LocateEntityFile(key2, options); Assert.Equal(expected2, actual2); }
public void TestNumericKeyWithoutPartitioning(string directory) { int key = 123; var basePath = FileSystemPath.Root.AppendDirectory(directory); var options = new FilesystemStorageOptions() { BasePath = basePath, EntitiesPerDirectory = 0 }; var expected = basePath.AppendDirectory(key.ToString()).AppendFile(EntityFilename); var actual = FilesystemLocator.LocateEntityFile(key, options); Assert.Equal(expected, actual); }
public void TestNonPartitionableKey(string directory, int entitiesPerDir) { var key = "Hello World"; var basePath = FileSystemPath.Root.AppendDirectory(directory); var options = new FilesystemStorageOptions() { BasePath = basePath, EntitiesPerDirectory = entitiesPerDir }; var expected = basePath.AppendDirectory(key.GetHashCode().ToString()) .AppendFile(EntityFilename); var actual = FilesystemLocator.LocateEntityFile(key, options); Assert.Equal(expected, actual); }