public void ShouldUpdate_WithoutAddingOffsets_ThrowsException() { // Arrange var offsets = new PartitionOffsets(); // Act Func <bool> act = () => offsets.ShouldCommit(1, out _); // Assert act.Should().Throw <InvalidOperationException>(); }
public void ShouldUpdateOffset_WithOneGap_ShouldNotUpdate() { // Arrange var offsets = new PartitionOffsets(); offsets.Enqueue(1); // Act var shouldUpdate = offsets.ShouldCommit(2, out var offset); // Assert Assert.IsFalse(shouldUpdate); Assert.AreEqual(-1, offset); }
public void ShouldUpdateOffset_NextOffset_ShouldUpdate() { // Arrange var offsets = new PartitionOffsets(); offsets.Enqueue(1); // Act var shouldUpdate = offsets.ShouldCommit(1, out var offset); // Assert Assert.IsTrue(shouldUpdate); Assert.AreEqual(1, offset); }