コード例 #1
0
        public void WhenThereAreNoItemsCannotAllocate()
        {
            var  cs = new ConsecutiveSequences();
            long l;

            Assert.False(cs.TryAllocate(1, out l));
        }
コード例 #2
0
		public void WhenHasOneItemWillReturnIt()
		{
			var cs = new ConsecutiveSequences {5};
			long l;
			Assert.True(cs.TryAllocate(1, out l));
			Assert.Equal(5, l);
		}
コード例 #3
0
        public void WhenHasOneItemWillReturnIt()
        {
            var cs = new ConsecutiveSequences {
                5
            };
            long l;

            Assert.True(cs.TryAllocate(1, out l));
            Assert.Equal(5, l);
        }
コード例 #4
0
		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);
		}
コード例 #5
0
        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);
        }
コード例 #6
0
		public void WhenThereAreNoItemsCannotAllocate()
		{
			var cs = new ConsecutiveSequences();
			long l;
			Assert.False(cs.TryAllocate(1, out l));
		}