public void FindsComb() { using (var dir = new TempDirectory()) { var hive = new RamHive("product"); hive.Catalog().Add("2CV"); Assert.NotEmpty( hive.Catalog().List() ); } }
public void AddsInParallel() { var valve = new LocalSyncPipe(); var hive = new RamHive("testRamHive"); Parallel.For(0, Environment.ProcessorCount << 4, (i) => { hive.Catalog().Add("123"); }); Assert.Equal(1, hive.Catalog().List().Count); }
public void ShiftsScope() { using (var dir = new TempDirectory()) { IHive hive = new RamHive("product"); hive.Catalog().Add("2CV"); hive = hive.Shifted("machine"); hive.Catalog().Add("DrRobotic"); Assert.Equal( 1, hive.Catalog().List().Count ); } }
public void UpdatesCellsInParallel() { var hive = new RamHive("product"); var comb = "Dr.Robotic"; var index = -1; var contents = new ConcurrentDictionary <string, string>(); new ParallelFunc(() => { var id = "Item_" + ++index; var content = Guid.NewGuid().ToString(); hive.Catalog().Add(comb); hive.Comb(comb).Cell(id).Update(new InputOf(content)); contents.AddOrUpdate(id, content, (a, b) => content); return(true); }, Environment.ProcessorCount << 4, 10000 ).Invoke(); Parallel.ForEach(contents.Keys, (record) => { Assert.Equal( contents[record], new TextOf(hive.Comb(comb).Cell(record).Content()).AsString() ); }); }
public void DeliversHQInParallelAfterShift() { var hive = new RamHive("person").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 WritesPropsInParallel() { var hive = new RamHive("product"); hive.Catalog().Add("2CV"); Parallel.For(0, Environment.ProcessorCount << 4, i => { hive.Comb("2CV").Props().Refined("looping", "louie"); }); Assert.Equal("louie", hive.Comb("2CV").Props().Value("looping")); }
public void ShiftsHQ() { using (var dir = new TempDirectory()) { var hive = new RamHive("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()); } }