Beispiel #1
0
        public void ShouldSetValueIfParamMaxIsLessThanValue(int originalValue, int maxValue)
        {
            _subject = new ValueDomainSegment(originalValue);

            _subject.SetMaximumAllowedValue(maxValue);

            if (originalValue > maxValue)
            {
                Assert.AreEqual(maxValue, _subject.GetValues(1).ToList()[0]);
            }
            else
            {
                Assert.AreEqual(originalValue, _subject.GetValues(1).ToList()[0]);
            }
        }
Beispiel #2
0
        public void ShouldReturnValueFromConstructorUsingGetValues(int value)
        {
            _subject = new ValueDomainSegment(value);

            var result = _subject.GetValues(1).ToList();

            Assert.AreEqual(value, result[0]);
        }
Beispiel #3
0
        public void ShouldReturnValueWhenMinSpecifiedIsValue(int value, int minimum, int maximum, bool expectItemReturned)
        {
            _subject = new ValueDomainSegment(value);

            var result = _subject.GetValues(minimum, maximum, 1).ToList();

            Assert.AreEqual(expectItemReturned, result.Count == 1);
        }
Beispiel #4
0
        public void ShouldReturnSingleValueFromSegmentWhenAskingForMultiple(int value)
        {
            _subject = new ValueDomainSegment(value);

            var result = _subject.GetValues(5).ToList();

            Assert.AreEqual(value, result[0], nameof(value));
            Assert.AreEqual(1, result.Count, nameof(result.Count));
        }
Beispiel #5
0
        public void ShouldReturnSingleValueThatMatchesCondition(int value, bool resultShouldHaveContent)
        {
            _subject = new ValueDomainSegment(value);

            var result = _subject.GetValues(v => v > 0, 1).ToList();

            Assert.AreEqual(resultShouldHaveContent, result.Count != 0);

            if (resultShouldHaveContent)
            {
                Assert.AreEqual(value, result[0]);
            }
        }