public void ThrowArgumentException_WhenMaximumIDReached() { // Arrange uint startId = 1; uint endId = 2; var provider = new IdProvider(startId, endId); uint firstAvailabeId = provider.GenerateID(); uint secondAvailableId = provider.GenerateID(); // No available IDs should left // Act and Assert Assert.ThrowsException <InvalidOperationException>(() => provider.GenerateID()); }
public void IncrementIDsByOne_WhenInvoked() { // Arrange uint expected = 1U; uint startId = 2; uint endId = 10; var provider = new IdProvider(startId, endId); // Act uint firstId = provider.GenerateID(); uint nextId = provider.GenerateID(); // Assert Assert.AreEqual(expected, nextId - firstId); }