protected override void Context() { base.Context(); _project = A.Fake <IProject>(); _subject1 = A.Fake <IWithId>(); _classifiable1 = A.Fake <IClassifiableWrapper>().WithId("1"); _classifiable2 = A.Fake <IClassifiableWrapper>().WithId("2"); A.CallTo(() => _repository.Get(_classifiable1.Id)).Returns(_subject1); A.CallTo(() => _repository.Get(_classifiable2.Id)).Returns(null); A.CallTo(() => _project.AllClassifiablesByType <IClassifiableWrapper>()).Returns(new[] { _classifiable1, _classifiable2 }); }
protected override void Context() { base.Context(); _project = new MoBiProject(); _simulation = A.Fake <IMoBiSimulation>().WithId("1"); _dataRepository = new DataRepository("2"); _classifiable1 = A.Fake <IClassifiableWrapper>().WithId(_simulation.Id); _classifiable2 = A.Fake <IClassifiableWrapper>().WithId(_dataRepository.Id); _classifiable3 = A.Fake <IClassifiableWrapper>().WithId("UNKNOWN"); _project.AddObservedData(_dataRepository); _project.AddSimulation(_simulation); _project.AddClassifiable(_classifiable1); _project.AddClassifiable(_classifiable2); _project.AddClassifiable(_classifiable3); }
protected abstract IWithId RetrieveSubjectFor(IClassifiableWrapper classifiableWrapper, IProject project);
protected override IWithId RetrieveSubjectFor(IClassifiableWrapper classifiableWrapper, IProject project) { return(observedDataFor(classifiableWrapper, project) ?? simulationFor(classifiableWrapper, project) ?? parameterAnalysableFor(classifiableWrapper, project)); }
private IWithId simulationFor(IClassifiableWrapper classifiableWrapper, IProject project) { var mobiProject = project.DowncastTo <IMoBiProject>(); return(mobiProject.Simulations.FindById(classifiableWrapper.Id)); }
private IWithId observedDataFor(IClassifiableWrapper classifiableWrapper, IProject project) { return(project.ObservedDataBy(classifiableWrapper.Id)); }
private IWithId parameterAnalysableFor(IClassifiableWrapper classifiableWrapper, IProject project) { return(project.AllParameterAnalysables.FindById(classifiableWrapper.Id)); }
protected override IWithId RetrieveSubjectFor(IClassifiableWrapper classifiableWrapper, IProject project) { return(_withIdRepository.Get(classifiableWrapper.Id)); }