Пример #1
0
        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()
                    );
            });
        }
Пример #2
0
        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"));
        }
Пример #3
0
        public void RemembersCombCell()
        {
            IHive hive = new RamHive("product");

            using (var cell = hive.Comb("2CV").Cell("Some-testing-item"))
            {
                cell.Update(new InputOf("I am a very cool testdata string"));
            }

            using (var cell = hive.Comb("2CV").Cell("Some-testing-item")
                   )
            {
                Assert.Equal(
                    "I am a very cool testdata string",
                    new TextOf(
                        cell.Content()
                        ).AsString()
                    );
            }
        }