コード例 #1
0
        public void ReadWriteDeathCount()
        {
            var container = new TestContainerManager().InitializeAndIsolateRepository();

            var testWrite = TestHelper.RandomInt();

            using (var context = container.GetInstance <BotDbContext>()) {
                var stateIntegerRepository = new StateIntegerRepository(context.StateIntegers);
                stateIntegerRepository.DeathCount = testWrite;
                context.SaveChanges();
            }

            long testRead;

            using (var context = container.GetInstance <BotDbContext>()) {
                var stateIntegerRepository = new StateIntegerRepository(context.StateIntegers);
                testRead = stateIntegerRepository.DeathCount;
            }

            Assert.AreEqual(testWrite, testRead);
        }
コード例 #2
0
        public void ReadWriteLatestStreamOffTime()
        {
            var container = new TestContainerManager().InitializeAndIsolateRepository();

            var testWrite = TestHelper.RandomDateTime();

            using (var context = container.GetInstance <BotDbContext>()) {
                var stateIntegerRepository = new StateIntegerRepository(context.StateIntegers);
                stateIntegerRepository.LatestStreamOffTime = testWrite;
                context.SaveChanges();
            }

            DateTime testRead;

            using (var context = container.GetInstance <BotDbContext>()) {
                var stateIntegerRepository = new StateIntegerRepository(context.StateIntegers);
                testRead = stateIntegerRepository.LatestStreamOffTime;
            }

            Assert.AreEqual(testWrite.Ticks, testRead.Ticks);
        }