Exemple #1
0
 public SimulationCompoundInteractionSelectionPresenter(ISimulationCompoundInteractionSelectionView view, IInteractionProcessRetriever interactionProcessRetriever) : base(view)
 {
     _interactionProcessRetriever   = interactionProcessRetriever;
     _noInteractionProcessSelection = new NoInteractionProcess();
     _interactionProcessRetriever.NotSelectedInteractionProcess = _noInteractionProcessSelection;
     _view.Warning = PKSimConstants.Warning.InhibitorClearanceMustBeDefinedSeparately;
 }
        protected override void Context()
        {
            _interactionProcessRetriever = A.Fake <IInteractionProcessRetriever>();
            _view = A.Fake <ISimulationCompoundInteractionSelectionView>();
            sut   = new SimulationCompoundInteractionSelectionPresenter(_view, _interactionProcessRetriever);

            _interactionProperties             = new InteractionProperties();
            _allSimulationInteractionProcesses = new List <SimulationPartialProcess>();
            _simulation = A.Fake <Simulation>();
            var individual = new Individual().WithName("Enzyme");

            _molecule1      = new IndividualEnzyme().WithName("CYP3A4");
            _undefinedLiver = new IndividualEnzyme().WithName(CoreConstants.Molecule.UndefinedLiver);
            individual.AddMolecule(_molecule1);
            individual.AddMolecule(_undefinedLiver);

            _interactionProcess1 = new InhibitionProcess().WithName("INTERACTION1");
            _interactionProcess2 = new InhibitionProcess().WithName("INTERACTION2");
            _interactionProcess3 = new InhibitionProcess().WithName("INTERACTION3");
            var comp1 = new Compound();

            comp1.AddProcess(_interactionProcess1);
            var comp2 = new Compound();

            comp2.AddProcess(_interactionProcess2);
            comp2.AddProcess(_interactionProcess3);

            _allSimulationInteractionProcesses.Add(new SimulationPartialProcess {
                CompoundProcess = _interactionProcess1, IndividualMolecule = _molecule1
            });
            _allSimulationInteractionProcesses.Add(new SimulationPartialProcess {
                CompoundProcess = _interactionProcess2, IndividualMolecule = _molecule1
            });

            A.CallTo(() => _simulation.InteractionProperties).Returns(_interactionProperties);
            A.CallTo(() => _simulation.Individual).Returns(individual);
            A.CallTo(() => _simulation.Compounds).Returns(new[] { comp1, comp2 });

            A.CallTo(_interactionProcessRetriever).WithReturnType <IReadOnlyList <SimulationPartialProcess> >()
            .Invokes(x => _useDefaultMap = x.GetArgument <bool>(2))
            .Returns(_allSimulationInteractionProcesses);

            A.CallTo(() => _view.BindTo(A <IEnumerable <SimulationInteractionProcessSelectionDTO> > ._))
            .Invokes(x => _allSimulationInteractionProcessSelectionDTO = x.GetArgument <IEnumerable <SimulationInteractionProcessSelectionDTO> >(0));
        }