Ejemplo n.º 1
0
        protected override void Context()
        {
            _moleculeParameterFactory = A.Fake <IMoleculeParameterRepository>();
            _advancedParmeterFactory  = A.Fake <IAdvancedParameterFactory>();
            _advancedParametersTask   = A.Fake <IAdvancedParametersTask>();
            _executionContext         = A.Fake <IExecutionContext>();
            sut = new MoleculeParameterVariabilityCreator(_advancedParmeterFactory, _moleculeParameterFactory, _advancedParametersTask, _executionContext);

            _randomPopulation = new RandomPopulation {
                Settings = new RandomPopulationSettings()
            };
            _randomPopulation.SetAdvancedParameters(new AdvancedParameterCollection());
            var individual = A.Fake <Individual>();

            _molecule1 = DomainHelperForSpecs.DefaultIndividualMolecule().WithName("CYP1");
            _molecule2 = DomainHelperForSpecs.DefaultIndividualMolecule().WithName("CYP2");
            A.CallTo(() => individual.AllMolecules()).Returns(new[] { _molecule1, _molecule2 });
            _randomPopulation.Settings.BaseIndividual = individual;

            A.CallTo(() => _advancedParametersTask.AddAdvancedParameter(A <IAdvancedParameter> ._, _randomPopulation))
            .Invokes(x =>
            {
                var advancedParameter = x.GetArgument <IAdvancedParameter>(0);
                _randomPopulation.AddAdvancedParameter(advancedParameter);
            })
            .Returns(new AddAdvancedParameterToContainerCommand(A.Fake <IAdvancedParameter>(), _randomPopulation, _executionContext));
        }