コード例 #1
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());
                });
        }
コード例 #2
0
        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());
                });
        }
コード例 #3
0
        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());
                });
        }
コード例 #4
0
        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());
                    });
            }
        }