Beispiel #1
0
        public void ShouldNotDeleteConflict()
        {
            var log = new InMemoryLog();

            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.DeleteConflictsFromThisLog(1, new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.ExposedForTesting.Count.ShouldBe(1);
        }
Beispiel #2
0
        public async Task ShouldDeleteConflict()
        {
            var log = new InMemoryLog();
            await log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));

            await log.DeleteConflictsFromThisLog(1, new LogEntry(new FakeCommand("test"), typeof(string), 2));

            log.ExposedForTesting.Count.ShouldBe(0);
        }
Beispiel #3
0
        public void ShouldDeleteConflictAndSubsequentLogsFromMidPoint()
        {
            var log = new InMemoryLog();

            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.Apply(new LogEntry(new FakeCommand("test"), typeof(string), 1));
            log.DeleteConflictsFromThisLog(4, new LogEntry(new FakeCommand("test"), typeof(string), 2));
            log.ExposedForTesting.Count.ShouldBe(3);
            log.ExposedForTesting[1].Term.ShouldBe(1);
            log.ExposedForTesting[2].Term.ShouldBe(1);
            log.ExposedForTesting[3].Term.ShouldBe(1);
        }