public void FindsComb() { using (var dir = new TempDirectory()) { var hive = new FileHive(dir.Value().FullName, "product"); hive.Catalog().Add("2CV"); Assert.NotEmpty( hive.Catalog().List() ); } }
public void AddsInParallel() { using (var dir = new TempDirectory()) { var hive = new FileHive(dir.Value().FullName, "product"); Parallel.For(0, Environment.ProcessorCount << 4, (i) => { hive.Catalog().Add("supercar"); }); Assert.Equal(1, hive.Catalog().List().Count); } }
public void ShiftsScope() { using (var dir = new TempDirectory()) { IHive hive = new FileHive(dir.Value().FullName, "product"); hive.Catalog().Add("2CV"); hive = hive.Shifted("machine"); hive.Catalog().Add("DrRobotic"); Assert.Equal( 1, hive.Catalog().List().Count ); } }
public void ShiftCreatesSubDir() { using (var dir = new TempDirectory()) { IHive hive = new FileHive(dir.Value().FullName, "cars"); hive = hive.Shifted("product"); hive.Catalog().Add("2CV"); using (var cell = hive.Comb("2CV").Cell("data") ) { cell.Update(new InputOf("bytes over bytes here...")); Assert.True( Directory.Exists( new Normalized( Path.Combine( dir.Value().FullName, "product", "2CV" ) ).AsString() ) ); } } }
public void DeliversHQInParallelAfterShift() { using (var dir = new TempDirectory()) { IHive hive = new FileHive(dir.Value().FullName, "product"); hive = hive.Shifted("still-parallel"); var first = true; Parallel.For(0, Environment.ProcessorCount << 4, i => { if (!first) { hive.Catalog().Remove("X"); first = false; } hive.Catalog().Add("X"); }); Assert.True(hive.Catalog().Has("X")); } }
public void ShiftsHQ() { using (var dir = new TempDirectory()) { var hive = new FileHive(dir.Value().FullName, "cockpit"); hive.Catalog().Add("log"); var shifted = hive.Shifted("factory"); shifted.Catalog().Add("booyaa"); var shiftedAgain = shifted.Shifted("cockpit"); Assert.Contains("log", shiftedAgain.Catalog().List()[0].Name()); } }
public void WorksWithFileHive() { using (var dir = new TempDirectory()) { var valve = new LocalSyncPipe(); var hive = new FileHive(dir.Value().FullName, "product"); hive.Catalog().Add("2CV"); Parallel.For(0, Environment.ProcessorCount << 4, i => { hive.Comb("2CV"); hive.Scope(); hive.HQ(); }); } }
public void CreatesHiveFolder() { using (var dir = new TempDirectory()) { var hive = new FileHive(dir.Value().FullName, "product"); hive.Catalog().Add("2CV"); using (var cell = hive.Comb("2CV").Cell("Some-testing-item")) { cell.Update(new InputOf("I am a very cool testdata string")); var productDir = Path.Combine(dir.Value().FullName, "product"); Assert.True( Directory.Exists(productDir), $"Directory '{productDir}' doesn't exist" ); } } }