public void Releases_Correctly_And_Return_True_If_Fully_Released() { // Arrange var item = new Reservable <object>(new object()); item.Reserve(); item.Reserve(); // Act, Assert Assert.Equal(2, item.Reservations); Assert.False(item.TryRelease()); Assert.Equal(1, item.Reservations); Assert.True(item.TryRelease()); Assert.Equal(0, item.Reservations); }
public void When_Releasing_An_Already_Released_Object() { // Arrange var reserved = new Reservable <int>(1); // Act, Assert Assert.Throws <InvalidOperationException>(() => reserved.TryRelease()); }