protected override void Context()
        {
            _view           = A.Fake <IXAndYNumericFieldsView>();
            _eventPublisher = A.Fake <IEventPublisher>();
            sut             = new XAndYNumericFieldsPresenter(_view, _eventPublisher);

            //common context for all tests
            A.CallTo(() => _view.BindTo(A <XandYFieldsSelectionDTO> ._))
            .Invokes(x => _dto = x.GetArgument <XandYFieldsSelectionDTO>(0));

            _field1 = A.Fake <PopulationAnalysisNumericField>();
            _field2 = A.Fake <PopulationAnalysisNumericField>();
            _field3 = A.Fake <PopulationAnalysisNumericField>();

            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            _populationAnalysis      = A.Fake <PopulationPivotAnalysis>();

            _allDataFields    = new List <IPopulationAnalysisField>();
            _allNumericFields = new List <IPopulationAnalysisField>();

            A.CallTo(() => _populationAnalysis.AllFieldsOn(PivotArea.DataArea)).Returns(_allDataFields);
            A.CallTo(() => _populationAnalysis.All(typeof(INumericValueField), false)).Returns(_allNumericFields);

            sut.StartAnalysis(_populationDataCollector, _populationAnalysis);
        }
        public void RefreshAnalysis()
        {
            var allNumericFields = _populationAnalysis.All(AllowedType);
            var allDataFields    = _populationAnalysis.AllFieldsOn(PivotArea.DataArea, AllowedType);

            _allFieldsSelection = allDataFields.Select(mapFrom).ToList();
            _allFieldsSelection.Each(dto => dto.Selected = true);
            allNumericFields.Where(f => !allDataFields.Contains(f)).Each(f => _allFieldsSelection.Add(mapFrom(f)));
            _view.BindTo(_allFieldsSelection);
        }
        public void RefreshAnalysis()
        {
            _allAvailableFields = _populationAnalysis.All(_allowedType).ToList();
            var allDataFields = allCurrentDataFields();

            if (allDataFields.Count == 0)
            {
                updateSelectionFrom(_allAvailableFields);
                updateDataFieldsBasedOnCurrentSelection();
            }
            else
            {
                updateSelectionFrom(allDataFields);
            }

            _view.BindTo(_selectionDTO);
        }
Beispiel #4
0
        protected override void Context()
        {
            _view           = A.Fake <IMultipleNumericFieldsView>();
            _eventPublisher = A.Fake <IEventPublisher>();
            sut             = new MultipleNumericFieldsPresenter(_view, _eventPublisher);

            _populationAnalysis = A.Fake <PopulationPivotAnalysis>();
            sut.StartAnalysis(A.Fake <IPopulationDataCollector>(), _populationAnalysis);

            _field1 = new PopulationAnalysisParameterField();
            _field2 = new PopulationAnalysisParameterField();
            _field3 = new PopulationAnalysisParameterField();

            _allAllowedFields = new List <IPopulationAnalysisField>();
            _allDataFields    = new List <IPopulationAnalysisField>();

            sut.AllowedType = _allowedType;
            A.CallTo(() => _view.BindTo(A <IEnumerable <FieldSelectionDTO> > ._))
            .Invokes(x => _fieldsDTO = x.GetArgument <IEnumerable <FieldSelectionDTO> >(0));

            A.CallTo(() => _populationAnalysis.All(_allowedType, false)).Returns(_allAllowedFields);
            A.CallTo(() => _populationAnalysis.AllFieldsOn(PivotArea.DataArea, _allowedType)).Returns(_allDataFields);
        }