protected override void Context() { _sim = new Container().WithName("S1"); _organ = new Container().WithName("Liver"); _cell = new Container().WithName("Cell"); _sim.Add(_organ); _organ.Add(_cell); _rootContainer = new ARootContainer().WithName("ROOT").WithParentContainer(new Container().WithName("SHOULD_NOT_BE_PART_OF_PATH")); _liver = new Container().WithName("Liver"); _liverCell = new Container().WithName("Cell"); _liver.Add(_liverCell); _rootContainer.Add(_liver); }
protected override void Context() { var entityPathFactory = new EntityPathResolverForSpecs(); _objectPathFactory = new ObjectPathFactory(new AliasCreator()); _simulation = A.Fake <IModelCoreSimulation>().WithName("Sim"); _simModelManager = A.Fake <ISimModelManager>(); _containerTask = A.Fake <IContainerTask>(); _options = new ScaleDivisorOptions(); _moleculeAmountCache = new PathCache <IMoleculeAmount>(entityPathFactory); var rootContainer = new ARootContainer().WithName(_simulation.Name) .WithContainerType(ContainerType.Simulation); _simulation.Model.Root = rootContainer; _moleculeAmount1 = new MoleculeAmount().WithName("M1"); _moleculeAmount2 = new MoleculeAmount().WithName("M2"); rootContainer.Add(_moleculeAmount1); rootContainer.Add(_moleculeAmount2); _moleculeAmountCache.Add(_moleculeAmount1); _moleculeAmountCache.Add(_moleculeAmount2); _molecule1Path = entityPathFactory.PathFor(_moleculeAmount1); _molecule2Path = entityPathFactory.PathFor(_moleculeAmount2); _originalResults = new DataRepository(); _simulation.Results = _originalResults; var baseGrid = new BaseGrid("Time", Constants.Dimension.NO_DIMENSION) { Values = new[] { 0f, 1f, 2f, 3f } }; _originalDataColumn = new DataColumn("M1", Constants.Dimension.NO_DIMENSION, baseGrid) { Values = new[] { 0f, 10f, 20f, 30f } }; _originalDataColumn.QuantityInfo.Path = _objectPathFactory.CreateAbsoluteObjectPath(_moleculeAmount1); _originalResults.Add(_originalDataColumn); A.CallTo(_containerTask).WithReturnType <PathCache <IMoleculeAmount> >().Returns(_moleculeAmountCache); var simResults = new DataRepository(); var baseGrid2 = new BaseGrid("Time", Constants.Dimension.NO_DIMENSION) { Values = new[] { 0f, 1f, 2f, 3f } }; var res1 = new DataColumn("M1", Constants.Dimension.NO_DIMENSION, baseGrid2) { Values = new[] { 0f, 10f, 20f, 30f } }; res1.QuantityInfo.Path = _objectPathFactory.CreateAbsoluteObjectPath(_moleculeAmount1); simResults.Add(res1); var res2 = new DataColumn("M2", Constants.Dimension.NO_DIMENSION, baseGrid2) { Values = new[] { 0f, 11f, 12f, 13f } }; res2.QuantityInfo.Path = _objectPathFactory.CreateAbsoluteObjectPath(_moleculeAmount2); simResults.Add(res2); var simulationRunResults = new SimulationRunResults(true, Enumerable.Empty <ISolverWarning>(), simResults); A.CallTo(() => _simModelManager.RunSimulation(_simulation)).Returns(simulationRunResults); sut = new ScaleDivisorCalculator(_simModelManager, _containerTask, _objectPathFactory); }