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); }
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); }
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); }