예제 #1
0
        public void TestMonth(string minValue, string maxValue, string rangeStart, string rangeEnd)
        {
            var calculator = _host.Services.GetRequiredService <IRangeCalculator>();

            calculator.Evaluate(DateTime.Parse(minValue), DateTime.Parse(maxValue));

            calculator.Alternatives.Should().NotBeEmpty();

            var bestFit = calculator.Alternatives.BestByInactiveRegions();

            bestFit.Should().NotBeNull();

            bestFit !.RangeStart.Should().Be(MonthNumber.GetMonthNumber(rangeStart));
            bestFit !.RangeEnd.Should().Be(MonthNumber.GetMonthNumber(rangeEnd));
        }
예제 #2
0
        public void TestDouble(double minValue, double maxValue, double rangeStart, double rangeEnd)
        {
            var calculator = _host.Services.GetRequiredService <IRangeCalculator>();

            calculator.Evaluate(minValue, maxValue);

            calculator.Alternatives.Should().NotBeEmpty();

            var bestFit = calculator.Alternatives.BestByInactiveRegions();

            bestFit.Should().NotBeNull();

            bestFit !.RangeStart.Should().Be(rangeStart);
            bestFit !.RangeEnd.Should().Be(rangeEnd);
        }
예제 #3
0
        public void DateTimeRangeOfTickSizes(RangeOfDates info)
        {
            _rangers.GetRange <DateTime, MonthRange>(info.ControlSize,
                                                     info.Minimum,
                                                     info.Maximum,
                                                     out var result,
                                                     info)
            .Should()
            .BeTrue();

            result.Should().NotBeNull();

            result !.RangeStart.Should().Be(info.RangeStart);
            result.RangeEnd.Should().Be(info.RangeEnd);

            result.MinorValue.Should().Be(info.MinorTick);
            result.MajorValue.Should().Be(info.MajorTick);
        }
예제 #4
0
        public void RangeOfTickSizes(RangeOfDates info)
        {
            var ranger = new MonthlyTickRange();

            ranger.Configure(info);

            ranger.GetRange(info.ControlSize,
                            info.Minimum,
                            info.Maximum,
                            out var result)
            .Should()
            .BeTrue();

            result.Should().NotBeNull();

            result !.RangeStart.Should().Be(info.RangeStart);
            result.RangeEnd.Should().Be(info.RangeEnd);

            result.MinorValue.Should().Be(info.MinorTick);
            result.MajorValue.Should().Be(info.MajorTick);
        }