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]); } }
public void ShouldReturnValueFromConstructorUsingGetValues(int value) { _subject = new ValueDomainSegment(value); var result = _subject.GetValues(1).ToList(); Assert.AreEqual(value, result[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); }
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)); }
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]); } }