public void WorksWithRamXocument() { var comb = new SyncComb( new RamComb("myRamComb") ); var xoc = comb.Xocument("test"); xoc.Modify(new Directives().Xpath("/test").Add("root").Add("items").Add("item").Attr("id", "123")); Assert.Equal("123", xoc.Values("/test/root/items/item/@id")[0]); }
public void WorksWithRamCell() { var comb = new SyncComb( new RamComb("myRamComb") ); Parallel.For(0, Environment.ProcessorCount << 4, i => { var cell = comb.Cell("myCell"); cell.Update(new InputOf("cell content")); Assert.Equal("cell content", new TextOf(cell.Content()).AsString()); }); }
public void WorksInParallelWithCell() { var comb = new SyncComb( new RamComb("my-comb") ); var content = "cell content"; Parallel.For(0, Environment.ProcessorCount << 4, (i) => { var cell = comb.Cell("syncCell"); cell.Update(new InputOf(content)); Assert.Equal(content, new TextOf(cell.Content()).AsString()); }); }
public void XocumentAndCellDoNotConflict() { var comb = new SyncComb( new RamComb("my-comb") ); Parallel.For(0, Environment.ProcessorCount << 4, (i) => { var xoc = comb.Xocument("synced"); xoc.Node(); Assert.Equal("<synced />", xoc.Node().ToString()); var cell = comb.Cell("synced"); cell.Update(new InputOf($"<synced />")); Assert.Equal($"<synced />", new TextOf(cell.Content()).AsString()); }); }
public void DoesNotBlockItself() { var comb = new SyncComb( new RamComb("my-comb") ); Parallel.For(0, Environment.ProcessorCount << 4, (i) => { var content = Guid.NewGuid().ToString(); comb.Xocument("synced") .Modify( new Directives() .Xpath("/synced") .Set(content) ); Assert.NotEmpty(comb.Xocument("synced").Value("/synced/text()", "")); }); }
public void WorksWithFileCell() { using (var file = new TempDirectory()) { var comb = new SyncComb( new FileComb( "myFileComb", file.Value().FullName ) ); var content = "my-content"; Parallel.For(0, Environment.ProcessorCount << 4, i => { var cell = comb.Cell("myCell"); cell.Update(new InputOf(content)); Assert.Equal(content, new TextOf(cell.Content()).AsString()); }); } }