private void addOutput(QuantitySelectionDTO output)
        {
            //Do not add simulation name as the output are already constructed as the intersection of all outputs available for all simulations
            var displayPathAsString = _quantityDisplayPathMapper.DisplayPathAsStringFor(output.Quantity, addSimulationName: false);

            _selectedOutputsPresenter.AddOutput(output.Quantity, displayPathAsString);
        }
예제 #2
0
        protected override void Context()
        {
            base.Context();
            var q1   = A.Fake <IQuantity>();
            var q2   = A.Fake <IQuantity>();
            var dto1 = new QuantitySelectionDTO {
                QuantityPath = "A|B|C"
            };

            dto1.PathElements[PathElement.Simulation]   = new PathElementDTO();
            dto1.PathElements[PathElement.TopContainer] = new PathElementDTO();
            dto1.PathElements[PathElement.Container]    = new PathElementDTO();
            dto1.SimulationPathElement.DisplayName      = "A";
            dto1.TopContainerPathElement.DisplayName    = "B";
            dto1.ContainerPathElement.DisplayName       = "C";
            var dto2 = new QuantitySelectionDTO {
                QuantityPath = "A|D"
            };

            dto2.PathElements[PathElement.Simulation]   = new PathElementDTO();
            dto2.PathElements[PathElement.TopContainer] = new PathElementDTO();
            dto2.SimulationPathElement.DisplayName      = "A";
            dto2.TopContainerPathElement.DisplayName    = "D";
            A.CallTo(() => _mapper.MapFrom(q1, A <int> ._)).Returns(dto1);
            A.CallTo(() => _mapper.MapFrom(q2, A <int> ._)).Returns(dto2);

            sut.Edit(new List <IQuantity> {
                q1, q2
            });
        }
예제 #3
0
 protected override void Context()
 {
     base.Context();
     _dto = new QuantitySelectionDTO {
         Selected = true
     };
     sut.SelectionChanged += (o, e) => { _e = e; };
 }
 public void QuantityDTODoubleClicked(QuantitySelectionDTO quantitySelectionDTO)
 {
     if (quantitySelectionDTO == null)
     {
         return;
     }
     QuantityDoubleClicked(this, new QuantityDoubleClickedEventArgs(quantitySelectionDTO));
 }
 public void UpdateSelection(QuantitySelectionDTO quantitySelectionDTO)
 {
     if (IsLatched)
     {
         return;
     }
     UpdateSelection(new[] { quantitySelectionDTO }, quantitySelectionDTO.Selected);
 }
        public void Add(QuantitySelectionDTO quantitySelectionDTO)
        {
            if (_quantitySelectionDTOList.Contains(quantitySelectionDTO))
            {
                return;
            }

            _quantitySelectionDTOList.Add(quantitySelectionDTO);
        }
 protected override void Context()
 {
     base.Context();
     _outputMapping.WeightedObservedData = new WeightedObservedData(DomainHelperForSpecs.ObservedData());
     _quantitySelectionDTO = new QuantitySelectionDTO {
         QuantityPath = "AA",
     };
     _availableOutputs.Add(new SimulationQuantitySelectionDTO(_simulation, _quantitySelectionDTO, "Display"));
     _outputMapping.OutputSelection = new SimulationQuantitySelection(_simulation, _quantitySelectionDTO.ToQuantitySelection());
 }
        protected override void Context()
        {
            base.Context();
            _quantityDTO1 = new QuantitySelectionDTO {
                QuantityPath = "toto", Selected = true
            };
            _selectedDTOs.Add(_quantityDTO1);
            A.CallTo(() => _selectedQuantityPresenter.AllQuantityDTOs).Returns(_selectedDTOs);
            sut.Edit(_simulation, _selectedQuantities);

            A.CallTo(() => _selectedQuantityPresenter.UpdateSelection(A <IReadOnlyList <QuantitySelectionDTO> > ._, false)).Invokes(x => _updatedDto = x.GetArgument <IReadOnlyList <QuantitySelectionDTO> >(0));
        }
        protected override void Context()
        {
            base.Context();

            //select 2 items
            _quantityDTO1 = new QuantitySelectionDTO {
                QuantityPath = "toto", Selected = true
            };
            _quantityDTO2 = new QuantitySelectionDTO {
                QuantityPath = "tata", Selected = false
            };

            _selectionDTO.AddRange(new[] { _quantityDTO1, _quantityDTO2 });

            sut.Edit(_simulation, _selectedQuantities);
        }
예제 #10
0
        protected void UpdateContainerDisplayNameAndIconsIfEmpty(QuantitySelectionDTO quantitySelectionDTO, IQuantity quantity)
        {
            var containerPathElement = quantitySelectionDTO.ContainerPathElement;

            if (!string.IsNullOrEmpty(containerPathElement.DisplayName) && !string.IsNullOrEmpty(containerPathElement.IconName))
            {
                return;
            }

            var parentContainer = quantity.ParentContainer;

            if (parentContainer == null)
            {
                return;
            }

            if (parentContainer.ContainerType == ContainerType.Molecule)
            {
                updatePathElement(containerPathElement, ObjectTypes.Molecule, parentContainer.Icon);
            }

            if (parentContainer.ContainerType == ContainerType.Formulation)
            {
                updatePathElement(containerPathElement, ObjectTypes.Formulation, ApplicationIcons.Formulation);
            }

            if (parentContainer.ContainerType == ContainerType.Organism)
            {
                updatePathElement(containerPathElement, Captions.Organism, ApplicationIcons.Organism);
            }

            if (parentContainer.ContainerType == ContainerType.Reaction)
            {
                updatePathElement(containerPathElement, ObjectTypes.Reaction, ApplicationIcons.Reaction);
            }

            if (quantity.HasAncestorWith(x => x.ContainerType == ContainerType.Application))
            {
                updatePathElement(containerPathElement, ObjectTypes.Application, ApplicationIcons.Application);
            }

            quantitySelectionDTO.PathElements[PathElementId.Container] = containerPathElement;
        }
예제 #11
0
        protected override void Context()
        {
            base.Context();
            _populationAnalysis      = A.Fake <PopulationStatisticalAnalysis>();
            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            _allOutputs = new PathCacheForSpecs <IQuantity>();
            _oneOutput  = new Observer {
                Name = "obs"
            };
            _allOutputs.Add(_oneOutput);
            A.CallTo(() => _outputsRetriever.OutputsFrom(_populationDataCollector)).Returns(_allOutputs);
            var dto = new QuantitySelectionDTO {
                Quantity = _oneOutput
            };

            dto.PathElements.Add(PathElement.TopContainer, new PathElementDTO {
                DisplayName = "TOTO"
            });
            A.CallTo(() => _allOutputsPresenter.QuantityDTOByPath(_allOutputs.Keys.First())).Returns(dto);
        }
        protected override void Context()
        {
            base.Context();
            _observer1             = A.Fake <IObserver>();
            _observer1.Persistable = true;
            _observer2             = A.Fake <IObserver>();
            _observer2.Persistable = true;
            _observer3             = A.Fake <IObserver>();
            _observer3.Persistable = false;
            _dto = new QuantitySelectionDTO();
            _quantities.AddRange(new[] { _observer1, _observer2, _observer3 });
            _selectedQuantities.Add(new QuantitySelection("observer2Path", QuantityType.Drug));
            _selectedQuantities.Add(new QuantitySelection("toto", QuantityType.Drug));

            A.CallTo(() => _allQuantityPresenter.Edit(A <IEnumerable <IQuantity> > ._))
            .Invokes(x => _allQuantities = x.GetArgument <IEnumerable <IQuantity> >(0).ToList());

            A.CallTo(() => _selectedQuantityPresenter.Edit(A <IEnumerable <QuantitySelectionDTO> > ._))
            .Invokes(x => _selectedQuantitiesDTO = x.GetArgument <IEnumerable <QuantitySelectionDTO> >(0).ToList());

            A.CallTo(() => _allQuantityPresenter.QuantityDTOByPath("observer2Path")).Returns(_dto);
            A.CallTo(() => _allQuantityPresenter.QuantityDTOByPath("toto")).Returns(null);
        }
 private void addOutput(QuantitySelectionDTO output)
 {
     addOutput(new[] { output });
 }
 public QuantityDoubleClickedEventArgs(QuantitySelectionDTO quantity)
 {
     Quantity = quantity;
 }
 public void Remove(QuantitySelectionDTO quantitySelectionDTO)
 {
     _quantitySelectionDTOList.Remove(quantitySelectionDTO);
 }