Esempio n. 1
0
        public void Read_items_persisted_in_single_batch()
        {
            var commands = new GetCommands().Get().ToArray();
            var _persist = new AppendToFile("Json_CustomerDataTests_2.db".Tap(db => dbs.Add(db)));

            _persist.Batch(commands);
            Assert.That(_persist.ReadAll().Count(), Is.EqualTo(commands.Length));
        }
Esempio n. 2
0
        public void Read_items()
        {
            var commands = new GetCommands().Get().ToArray();
            var _persist = new AppendToFile("Json_CustomerDataTests_3.db".Tap(db => dbs.Add(db)));

            _persist.Batch(commands);
            Assert.That(_persist.ReadAll().Select(c => c.GetType()).ToArray(), Is.EquivalentTo(commands.Select(c => c.GetType()).ToArray()));
        }
Esempio n. 3
0
        public void Read_items_persisted_in_separate_batches()
        {
            var commands = new GetCommands().Get().ToArray();
            var _persist = new AppendToFile("Json_CustomerDataTests_1.db".Tap(db => dbs.Add(db)));
            var batches  = commands.BatchesOf(3).ToArray();

            // in order for the test to be valid
            Assert.That(batches.Length, Is.GreaterThan(2));
            foreach (var batch in batches)
            {
                _persist.Batch(batch);
            }
            Assert.That(_persist.ReadAll().Count(), Is.EqualTo(commands.Length));
        }