public void DeleteConflictsFromThisLogThatNoConflicts() { ILog log = new InMemoryLog(); var newLogEntries = new LogEntry[] { new LogEntry("System.String", null, 123L), new LogEntry("System.String", null, 123L), new LogEntry("System.String", null, 124L), new LogEntry("System.String", null, 124L), new LogEntry("System.String", null, 124L) }; log.BatchAppendAsync(newLogEntries).Wait(); var newLogEntries2 = new LogEntry[] { new LogEntry("System.String", null, 124L), new LogEntry("System.String", null, 124L) }; log.DeleteConflictsFromThisLogAsync(2, newLogEntries2).Wait(); Assert.Equal(newLogEntries.Length, log.CountAsync().Result); }
public void BatchAppendLogEntry() { ILog log = new InMemoryLog(); var newLogEntries = new LogEntry[] { new LogEntry("System.String", null, 123L), new LogEntry("System.String", null, 123L), new LogEntry("System.String", null, 124L), new LogEntry("System.String", null, 124L), new LogEntry("System.String", null, 124L) }; log.BatchAppendAsync(newLogEntries).Wait(); for (var logIndex = 1L; logIndex <= newLogEntries.Length; logIndex++) { var lastLog = log.GetAsync(logIndex).Result; Assert.NotNull(lastLog); Assert.Equal(newLogEntries[logIndex - 1].CommandData, lastLog.CommandData); Assert.Equal(newLogEntries[logIndex - 1].Term, lastLog.Term); } }