Пример #1
0
        public void ToRegexString_ReturnsSingleStringOnce_WhenNoRepeatIntervalWasProvided()
        {
            _randomGenerator.GetNextInteger(1, 1).Returns(1);
            var expression = new BaseExpressionTest(_randomGenerator);

            var result = expression.ToStringBuilder().GenerateString();

            Assert.AreEqual("F", result);
        }
Пример #2
0
        public void ToRegexString_ReturnsSingleString3Times_WhenRepeatIntervalIs3To3()
        {
            var expression = new BaseExpressionTest(_randomGenerator)
            {
                RepeatRange = new IntegerInterval(3)
            };

            _randomGenerator.GetNextInteger(3, 3).Returns(3);

            var result = expression.ToStringBuilder().GenerateString();

            Assert.AreEqual("FFF", result);
            _randomGenerator.Received(1).GetNextInteger(3, 3);
        }
Пример #3
0
        public void ToRegexString_CallsRandomGeneratorWithExpectedUpperBound_WhenIntegerIntervalsUpperBoundHasSpecifiedValue(int?value, int expectedValue)
        {
            var interval = new IntegerInterval();

            interval.TrySetValue(-2, value);

            var expression = new BaseExpressionTest(_randomGenerator)
            {
                RepeatRange = interval
            };

            expression.ToStringBuilder();

            _randomGenerator.Received(1).GetNextInteger(0, expectedValue);
        }