Exemple #1
0
        public void Test_IncreasingSequenceIsIncreasing()
        {
            var sequence = UniqueSequenceGenerator.GenerateIncreasingSequence(100 * 1000)
                           .ToList();

            Assert.IsTrue(
                sequence.Select((_item, _index) => _index == 0 || sequence[_index - 1] < _item)
                .All(_ => _));
            Assert.IsTrue(sequence.AllUnique());
        }
Exemple #2
0
 public void Test_SequenceWithNonsensicalLengthThrows()
 {
     Assert.Throws <ArgumentOutOfRangeException>(
         () =>
     {
         var foo = UniqueSequenceGenerator.GenerateDecreasingSequence(-1)
                   .ToList();
     });
     Assert.Throws <ArgumentOutOfRangeException>(
         () =>
     {
         var foo = UniqueSequenceGenerator.GenerateIncreasingSequence(-1)
                   .ToList();
     });
 }
Exemple #3
0
 public void Test_SequenceWithNonNegativeLengthHasCorrectLength()
 {
     Assert.AreEqual(
         0,
         UniqueSequenceGenerator.GenerateDecreasingSequence(0)
         .Count());
     Assert.AreEqual(
         0,
         UniqueSequenceGenerator.GenerateIncreasingSequence(0)
         .Count());
     Assert.AreEqual(
         10,
         UniqueSequenceGenerator.GenerateDecreasingSequence(10)
         .Count());
     Assert.AreEqual(
         10,
         UniqueSequenceGenerator.GenerateIncreasingSequence(10)
         .Count());
 }
Exemple #4
0
        public void Test_IncreasingSequenceIsUnique()
        {
            var sequence = UniqueSequenceGenerator.GenerateIncreasingSequence(100 * 1000);

            Assert.IsTrue(sequence.AllUnique());
        }