private async Task <ModelObservedDataCurveOptions> curveOptionsFrom(ObservedDataCurveOptions snapshot, List <OSPSuite.Core.Domain.Data.DataColumn> allObservedDataColumns)
        {
            var column = allObservedDataColumns.Find(x => string.Equals(x.PathAsString, snapshot.Path));

            if (column == null)
            {
                return(null);
            }

            var observedDataCurveOption = new ModelObservedDataCurveOptions
            {
                ColumnId = column.Id,
                Caption  = snapshot.Caption,
            };

            observedDataCurveOption.CurveOptions.UpdateFrom(await _curveOptionsMapper.MapToModel(snapshot.CurveOptions));
            return(observedDataCurveOption);
        }
Example #2
0
        protected override Task Context()
        {
            _curveOptionsMapper = A.Fake <CurveOptionsMapper>();
            sut = new ObservedDataCollectionMappper(_curveOptionsMapper);

            _observedDataRepository = DomainHelperForSpecs.ObservedData("ID").WithName("ObsData");
            _observedDataCollection = new Model.PopulationAnalyses.ObservedDataCollection();
            _observedDataCollection.ApplyGroupingToObservedData = true;
            _observedDataCollection.AddObservedData(_observedDataRepository);
            _firstObservedDataColumn  = _observedDataRepository.ObservationColumns().First();
            _observedDataCurveOptions = new ObservedDataCurveOptions
            {
                Caption  = "Obs Data Caption",
                ColumnId = _firstObservedDataColumn.Id
            };

            _observedDataCollection.AddCurveOptions(_observedDataCurveOptions);
            _snapshotCurveOptions = new CurveOptions();
            A.CallTo(() => _curveOptionsMapper.MapToSnapshot(_observedDataCurveOptions.CurveOptions)).Returns(_snapshotCurveOptions);
            return(_completed);
        }