public void WhenThereAreNoItemsCannotAllocate() { var cs = new ConsecutiveSequences(); long l; Assert.False(cs.TryAllocate(1, out l)); }
public void WhenHasOneItemWillReturnIt() { var cs = new ConsecutiveSequences {5}; long l; Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(5, l); }
public void WhenHasOneItemWillReturnIt() { var cs = new ConsecutiveSequences { 5 }; long l; Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(5, l); }
public void WillDetectSequenceOutOfOrder2() { var cs = new ConsecutiveSequences {6, 18, 5}; long l; Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(18, l); Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(5, l); Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(6, l); }
public void WillDetectSequenceOutOfOrder2() { var cs = new ConsecutiveSequences { 6, 18, 5 }; long l; Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(18, l); Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(5, l); Assert.True(cs.TryAllocate(1, out l)); Assert.Equal(6, l); }