protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Simple);

            _nodeToActivate    = A.Fake <ITreeNode <IGroup> >();
            _group             = A.Fake <IGroup>();
            _group.DisplayName = "tutu";
            A.CallTo(() => _nodeToActivate.Tag).Returns(_group);
            _validPresenter = A.Fake <ICustomParametersPresenter>();
            var pkSimParameter = A.Fake <IParameter>();

            pkSimParameter.Visible = true;
            A.CallTo(() => pkSimParameter.GroupName).Returns("group1");
            var pkSimParameter2 = A.Fake <IParameter>();

            A.CallTo(() => pkSimParameter2.GroupName).Returns("group1");
            pkSimParameter2.Visible = true;
            _allParameters.Add(pkSimParameter);
            _allParameters.Add(pkSimParameter2);
            A.CallTo(() => _groupRepository.GroupByName("group1")).Returns(_group);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_nodeToActivate)).Returns(_validPresenter);
            A.CallTo(() => _parameterGroupTask.TopGroupsUsedBy(A <IEnumerable <IParameter> > ._)).Returns(new[] { _group });
            A.CallTo(() => _parameterGroupTask.ParametersIn(_group, A <IEnumerable <IParameter> > ._)).Returns(new[] { pkSimParameter, pkSimParameter2 });
            A.CallTo(() => _groupNodeCreator.MapFrom(_group, A <IReadOnlyCollection <IParameter> > ._)).Returns(_nodeToActivate);

            sut.InitializeWith(_organism, _allParameters);

            sut.ActivateNode(_nodeToActivate);
        }
        protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Simple);

            _group1 = new Group {
                Name = "Group1", Visible = true
            };
            _group2 = new Group {
                Name = "Group2", Visible = true
            };

            _group1.IsAdvanced       = false;
            _nodeGroup1              = new GroupNode(_group1);
            _nodeGroup2              = new GroupNode(_group2);
            _parameterEditPresenter1 = A.Fake <ICustomParametersPresenter>();
            _parameterEditPresenter2 = A.Fake <ICustomParametersPresenter>();
            _parameterGroups         = new List <IGroup> {
                _group1, _group2
            };

            A.CallTo(() => _groupNodeCreator.MapFrom(_group1, A <IReadOnlyCollection <IParameter> > ._)).Returns(_nodeGroup1);
            A.CallTo(() => _groupNodeCreator.MapFrom(_group2, A <IReadOnlyCollection <IParameter> > ._)).Returns(_nodeGroup2);
            A.CallTo(() => _parameterGroupTask.TopGroupsUsedBy(A <IEnumerable <IParameter> > .Ignored)).Returns(_parameterGroups);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_nodeGroup1)).Returns(_parameterEditPresenter1);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_nodeGroup2)).Returns(_parameterEditPresenter2);
            A.CallTo(() => _parameterGroupTask.ParametersIn(_group1, A <IEnumerable <IParameter> > .Ignored)).Returns(new List <IParameter>());
            A.CallTo(() => _view.AddNodes(A <IEnumerable <ITreeNode> > .Ignored)).Invokes(x => _nodes = x.GetArgument <IEnumerable <ITreeNode> >(0));
        }
 protected override void Context()
 {
     base.Context();
     _node      = A.Fake <ITreeNode <IContainer> >();
     _presenter = A.Fake <ICustomParametersPresenter>();
     A.CallTo(() => _node.Tag).Returns(A.Fake <IContainer>());
     A.CallTo(() => _containerPresentrMapper.MapFrom(_node.Tag)).Returns(_presenter);
 }
        protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Advanced);
            _alwaysRefreshPresenter = A.Fake <ICustomParametersPresenter>();
            A.CallTo(() => _alwaysRefreshPresenter.AlwaysRefresh).Returns(true);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_groupUserDefinedNode)).Returns(_alwaysRefreshPresenter);
            var visibleParameter = A.Fake <IParameter>();

            visibleParameter.Visible = true;
            _allParameters.Add(visibleParameter);

            sut.InitializeWith(_organism, _allParameters);
        }
        protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Simple);

            _fullPath = "A B C";
            _group    = new Group {
                Name = "toto"
            };
            _group.IsAdvanced = false;

            _anotherGroup = new Group {
                Name = "toto"
            };
            _anotherGroup.IsAdvanced = false;

            _parameterEditPresenter = A.Fake <ICustomParametersPresenter>();
            A.CallTo(() => _parameterEditPresenter.BaseView).Returns(A.Fake <IMultiParameterEditView>());
            //One visible parameter
            _visibleParameter = A.Fake <IParameter>();
            A.CallTo(() => _visibleParameter.Rules).Returns(new BusinessRuleSet());
            _visibleParameter.Visible = true;
            _visibleParameter.Name    = "toto";
            A.CallTo(() => _visibleParameter.GroupName).Returns("toto");
            //One hidden parameter
            _hiddenParameter         = A.Fake <IParameter>();
            _hiddenParameter.Visible = false;
            A.CallTo(() => _hiddenParameter.GroupName).Returns("tata");
            _hiddenParameter.Name = "tata";

            _allParameters.AddRange(new[] { _visibleParameter, _hiddenParameter });
            _parameterGroupNode      = A.Fake <ITreeNode <IGroup> >();
            _parameterGroupNode.Text = "toto";
            A.CallTo(() => _parameterGroupNode.FullPath(PKSimConstants.UI.DisplayPathSeparator)).Returns(_fullPath);
            _selectedGroup             = A.Fake <IGroup>();
            _selectedGroup.DisplayName = "toto";
            A.CallTo(() => _parameterGroupNode.Tag).Returns(_selectedGroup);
            A.CallTo(() => _parameterGroupTask.TopGroupsUsedBy(A <IEnumerable <IParameter> > .Ignored)).Returns(new[] { _selectedGroup });

            A.CallTo(() => _parameterPresenterMapper.MapFrom(_parameterGroupNode)).Returns(_parameterEditPresenter);
            A.CallTo(() => _parameterGroupTask.ParametersIn(_selectedGroup, A <IEnumerable <IParameter> > .Ignored)).Returns(new[] { _visibleParameter });
            A.CallTo(() => _groupRepository.GroupByName(_visibleParameter.GroupName)).Returns(_group);
            A.CallTo(() => _groupRepository.GroupByName(_hiddenParameter.GroupName)).Returns(_anotherGroup);
            var visibleParameterDTO = A.Fake <ParameterDTO>();

            A.CallTo(() => visibleParameterDTO.Name).Returns(_visibleParameter.Name);

            sut.InitializeWith(_organism, _allParameters);
        }
        protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Advanced);

            _validPresenter           = A.Fake <ICustomParametersPresenter>();
            _visibleParameter         = A.Fake <IParameter>();
            _visibleParameter.Visible = true;
            var hiddenParameter = A.Fake <IParameter>();

            hiddenParameter.Visible = false;
            _allParameters.Add(_visibleParameter);
            _allParameters.Add(hiddenParameter);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_groupUserDefinedNode)).Returns(_validPresenter);
            A.CallTo(() => _validPresenter.Edit(A <IEnumerable <IParameter> > .Ignored)).Invokes(x => _parameters = x.GetArgument <IEnumerable <IParameter> >(0));
            sut.InitializeWith(_organism, _allParameters);
            sut.ParameterGroupingMode = ParameterGroupingModes.Advanced;
        }
示例#7
0
        public void ActivateNode(ITreeNode node)
        {
            if (node == null)
            {
                return;
            }

            var alreadyLoaded = _parameterPresenterCache.Contains(node);

            _activePresenter         = presenterFor(node);
            _settings.SelectedNodeId = node.Id;

            //this needs to be done before editing the parameters
            _view.ActivateView(_activePresenter.BaseView);

            if (alreadyLoaded && !_activePresenter.AlwaysRefresh)
            {
                return;
            }

            _activePresenter.Edit(allVisibleParametersIn(node));
        }
        public void ActivateNode(ITreeNode node)
        {
            if (node == null)
            {
                return;
            }

            _view.GroupCaption = node.FullPath(PKSimConstants.UI.DisplayPathSeparator);

            bool alreadyLoaded = _parameterPresenterCache.Contains(node);

            _activePresenter         = presenterFor(node);
            _settings.SelectedNodeId = node.Id;

            //this needs to be done before editing the parameters
            _view.ActivateView(_activePresenter.BaseView);

            if (alreadyLoaded)
            {
                return;
            }

            _activePresenter.Edit(allVisibleParametersIn(node));
        }
        protected override void Context()
        {
            base.Context();
            CreateSutForSettings(ParameterGroupingModeId.Advanced);

            _group                    = A.Fake <IGroup>();
            _validPresenter           = A.Fake <ICustomParametersPresenter>();
            _visibleParameter         = A.Fake <IParameter>();
            _visibleParameter.Visible = true;
            var hiddenParameter = A.Fake <IParameter>();

            hiddenParameter.Visible = false;
            _allParameters.Add(_visibleParameter);
            _allParameters.Add(hiddenParameter);
            A.CallTo(() => _visibleParameter.GroupName).Returns("toto");
            A.CallTo(() => hiddenParameter.GroupName).Returns("toto");
            A.CallTo(() => _groupRepository.GroupByName(_visibleParameter.GroupName)).Returns(_group);
            A.CallTo(() => _parameterPresenterMapper.MapFrom(_groupAllNode)).Returns(_validPresenter);
            A.CallTo(() => _parameterGroupTask.TopGroupsUsedBy(A <IEnumerable <IParameter> > .Ignored)).Returns(new[] { _group });
            A.CallTo(() => _parameterGroupTask.ParametersIn(_group, _allParameters)).Returns(new[] { _visibleParameter, hiddenParameter });
            A.CallTo(() => _validPresenter.Edit(A <IEnumerable <IParameter> > .Ignored)).Invokes(x => _parameters = x.GetArgument <IEnumerable <IParameter> >(0));
            sut.InitializeWith(_organism, _allParameters);
            sut.ParameterGroupingMode = ParameterGroupingModes.Advanced;
        }