protected override void Context()
        {
            base.Context();
            _groupingDefinition = new FixedLimitsGroupingDefinition(_field.Name);
            _groupingDefinition.SetLimits(new[] { 1d, 2d }.OrderBy(x => x));
            _groupingDefinition.AddItem(new GroupingItem {
                Label = "Label1"
            });
            _groupingDefinition.AddItem(new GroupingItem {
                Label = "Label2"
            });
            _groupingDefinition.AddItem(new GroupingItem {
                Label = "Label3"
            });

            A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_unit, 1d)).Returns(10);
            A.CallTo(() => _dimension.BaseUnitValueToUnitValue(_unit, 2d)).Returns(20);

            sut.InitializeWith(_field, _populationDataCollector);
        }
Beispiel #2
0
        protected override Task Context()
        {
            _dimensionRepository = A.Fake <IDimensionRepository>();
            sut            = new GroupingDefinitionMapper(_dimensionRepository);
            _groupingItem1 = new GroupingItem();
            _groupingItem2 = new GroupingItem();

            _dimension = DomainHelperForSpecs.TimeDimensionForSpecs();
            _unit      = _dimension.Unit("h");

            A.CallTo(() => _dimensionRepository.DimensionByName(_dimension.Name)).Returns(_dimension);
            _valueMappingGrouping = new ValueMappingGroupingDefinition("F1");
            _valueMappingGrouping.AddValueLabel("Item1", _groupingItem1);
            _valueMappingGrouping.AddValueLabel("Item2", _groupingItem2);

            _fixedLimitGrouping = new FixedLimitsGroupingDefinition("F1")
            {
                DisplayUnit = _unit,
                Dimension   = _dimension,
            };

            _fixedLimitGrouping.SetLimits(new[] { 60, 120.0 }.OrderBy(x => x));
            _fixedLimitGrouping.AddItem(_groupingItem1);
            _fixedLimitGrouping.AddItem(_groupingItem2);

            _numberOfBinsGrouping = new NumberOfBinsGroupingDefinition("F1")
            {
                DisplayUnit   = _unit,
                Dimension     = _dimension,
                NumberOfBins  = 4,
                NamingPattern = "TOTO",
                StartColor    = Color.Aqua,
                EndColor      = Color.Red,
                Strategy      = LabelGenerationStrategies.Numeric
            };

            _numberOfBinsGrouping.AddItem(_groupingItem1);
            _numberOfBinsGrouping.AddItem(_groupingItem2);

            return(_completed);
        }