Пример #1
0
 public void FindsComb()
 {
     using (var dir = new TempDirectory())
     {
         var hive = new RamHive("product");
         hive.Catalog().Add("2CV");
         Assert.NotEmpty(
             hive.Catalog().List()
             );
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
 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
             );
     }
 }
Пример #4
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()
                    );
            });
        }
Пример #5
0
        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"));
        }
Пример #6
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"));
        }
Пример #7
0
        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());
            }
        }