public void IndexingHistory_CheckForAdd() { var history = new IndexingHistory(); var historyAcc = new IndexingHistoryAccessor(history); var size = 5; historyAcc.Initialize(size); Assert.IsTrue(history.Count == 0, string.Format("history.Count is {0}, expected: 0 (size: {1})", history.Count, size)); Assert.IsTrue(history.CheckForAdd(42, new Timestamps(1111, 1111)), "CheckForAdd(42, 1111) first call returned with false"); Assert.IsFalse(history.CheckForAdd(42, new Timestamps(1111, 1111)), "CheckForAdd(42, 1111) second call returned with true"); Assert.IsFalse(history.CheckForAdd(42, new Timestamps(1110, 1110)), "CheckForAdd(42, 1110) returned with true"); Assert.IsFalse(history.CheckForAdd(42, new Timestamps(1112, 1112)), "CheckForAdd(42, 1112) returned with true"); Assert.IsTrue(history.CheckForAdd(43, new Timestamps(1111, 1111)), "CheckForAdd(43, 1111) first call returned with false"); Assert.IsFalse(history.CheckForAdd(43, new Timestamps(1111, 1111)), "CheckForAdd(43, 1111) second call returned with true"); Assert.IsFalse(history.CheckForAdd(43, new Timestamps(1110, 1110)), "CheckForAdd(43, 1110) returned with true"); Assert.IsFalse(history.CheckForAdd(43, new Timestamps(1112, 1112)), "CheckForAdd(43, 1112) returned with true"); Assert.IsTrue(history.Count == 2, string.Format("history.Count is {0}, expected: 2 (size: {1})", history.Count, size)); Assert.IsTrue(history.CheckForAdd(44, new Timestamps(1111, 1111)), "CheckForAdd(44, 1111) returned with false"); Assert.IsTrue(history.CheckForUpdate(44, new Timestamps(1112, 1112)), "CheckForUpdate(44, 1112) returned with false"); Assert.IsFalse(history.CheckForAdd(44, new Timestamps(1113, 1113)), "CheckForAdd(44, 1113) rreturned with true"); }
public void IndexingHistory_ProcessDelete() { var history = new IndexingHistory(); var historyAcc = new IndexingHistoryAccessor(history); var size = 5; historyAcc.Initialize(size); Assert.IsTrue(history.Count == 0, string.Format("history.Count is {0}, expected: 0 (size: {1})", history.Count, size)); history.ProcessDelete(42); Assert.IsFalse(history.CheckForAdd(42, 1111), "CheckForAdd(42, 1111) returned with true"); Assert.IsFalse(history.CheckForUpdate(42, 1112), "CheckForUpdate(42, 1111) returned with true"); Assert.IsTrue(history.CheckForUpdate(43, 1111), "CheckForAdd(43, 1111) first call returned with false"); history.ProcessDelete(43); Assert.IsFalse(history.CheckForUpdate(43, 1111), "CheckForUpdate(43, 1111) second call returned with true"); Assert.IsTrue(history.Count == 2, string.Format("history.Count is {0}, expected: 2 (size: {1})", history.Count, size)); }