Example #1
0
        public void IsInRange_With_Value_Not_In_Range_On_Edge_With_Maximum_Excluded_Returns_False()
        {
            IRange <int> range = 0.ToRange(100, RangeComparisonOptions.Create().WithMaximumExcluded());
            var          sut   = new CompareInt32Range();

            Assert.False(sut.IsInRange(100, range));
        }
        public void Is_not_in_range_when_maximum_value_provided_and_maximum_is_excluded()
        {
            var range = GetOctober11th1985Range(RangeComparisonOptions.Create().WithMaximumExcluded());
            var sut   = new CompareDateTimeRange();

            Assert.False(sut.IsInRange(range.Maximum, range));
        }
Example #3
0
        public void IsInRange_With_Value_In_Range_On_Edge_With_Maximum_Excluded_Returns_True()
        {
            IRange <long> range = 0L.ToRange(100, RangeComparisonOptions.Create().WithMaximumExcluded());
            var           sut   = new CompareInt64Range();

            Assert.True(sut.IsInRange(99, range));
        }
        public void Build_without_options_yields_minimum_and_maximum_included()
        {
            RangeComparisonOptions sut = RangeComparisonOptions.Create();

            Assert.True(sut.IsMinimumIncluded);
            Assert.True(sut.IsMaximumIncluded);
        }
Example #5
0
        public void IsInRange_With_Value_In_Range_On_Edge_With_Minimum_Excluded_Returns_True()
        {
            IRange <short> range = 0.ToInt16Range(100, RangeComparisonOptions.Create().WithMinimumExcluded());
            var            sut   = new CompareInt16Range();

            Assert.True(sut.IsInRange(1, range));
        }
 private static IEnumerable <object[]> BuildScenarios()
 {
     return(new List <object[]> {
         new object[] {
             "Default build",
             RangeComparisonOptions.Create(),
             true, true,
         },
         new object[] {
             "Minimum included, Maximum excluded",
             RangeComparisonOptions.Create()
             .WithMaximumExcluded(),
             true, false,
         },
         new object[] {
             "Minimum included, Maximum excluded",
             RangeComparisonOptions.Create()
             .WithMinimumIncluded()
             .WithMaximumExcluded(),
             true, false,
         },
         new object[] {
             "Minimum excluded, Maximum excluded",
             RangeComparisonOptions.Create()
             .WithMinimumExcluded()
             .WithMaximumExcluded(),
             false, false,
         },
         new object[] {
             "Minimum excluded, Maximum included",
             RangeComparisonOptions.Create()
             .WithMinimumExcluded(),
             false, true,
         },
         new object[] {
             "Minimum excluded, Maximum included",
             RangeComparisonOptions.Create()
             .WithMaximumIncluded()
             .WithMinimumExcluded(),
             false, true,
         },
     });
 }
 public Int32RangeBuilder WithRangeComparsionOptions(RangeComparisonOptions rangeComparisonOptions = null)
 => With(x => x.RangeComparisonOptions, rangeComparisonOptions ?? RangeComparisonOptions.Create());