Пример #1
0
        protected override Task Context()
        {
            _dataColumnMapper       = A.Fake <DataColumnMapper>();
            _extendedPropertyMapper = A.Fake <ExtendedPropertyMapper>();
            sut = new DataRepositoryMapper(_extendedPropertyMapper, _dataColumnMapper);

            _dataRepository = DomainHelperForSpecs.ObservedData();
            _dataColumn     = _dataRepository.ObservationColumns().First();
            _relatedColumn  = new DataColumn("related", DomainHelperForSpecs.NoDimension(), _dataRepository.BaseGrid)
            {
                Values   = new[] { 0f, 0f, 0f },
                DataInfo = { Origin = ColumnOrigins.ObservationAuxiliary }
            };
            _dataColumn.AddRelatedColumn(_relatedColumn);
            _dataRepository.Add(_relatedColumn);
            _dataRepository.Description = "description";
            _dataRepository.Name        = "thename";
            _extendedProperty           = new ExtendedProperty <string> {
                Name = "Name"
            };
            _dataRepository.ExtendedProperties.Add(_extendedProperty);
            _dataColumnSnapshot       = new Snapshots.DataColumn();
            _extendedPropertySnapshot = new Snapshots.ExtendedProperty();
            _baseGridSnapshot         = new Snapshots.DataColumn();
            A.CallTo(() => _dataColumnMapper.MapToSnapshot(_dataColumn)).Returns(_dataColumnSnapshot);
            A.CallTo(() => _extendedPropertyMapper.MapToSnapshot(_extendedProperty)).Returns(_extendedPropertySnapshot);
            A.CallTo(() => _extendedPropertyMapper.MapToModel(_extendedPropertySnapshot, A <SnapshotContext> ._)).Returns(_extendedProperty);
            A.CallTo(() => _dataColumnMapper.MapToSnapshot(_dataRepository.BaseGrid)).Returns(_baseGridSnapshot);

            return(Task.FromResult(true));
        }
Пример #2
0
        protected override async Task Context()
        {
            await base.Context();

            _snapshot = await sut.MapToSnapshot(_dataRepository);

            _baseGrid            = new BaseGrid("baseGrid", DomainHelperForSpecs.TimeDimensionForSpecs());
            _mappedDataColumn    = new DataColumn("DataColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedRelatedColumn = new DataColumn("RelatedColumn", DomainHelperForSpecs.ConcentrationDimensionForSpecs(), _baseGrid);
            _mappedDataColumn.AddRelatedColumn(_mappedRelatedColumn);

            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.BaseGrid, A <SnapshotContextWithDataRepository> ._)).Returns(_baseGrid);
            A.CallTo(() => _dataColumnMapper.MapToModel(_snapshot.Columns.First(), A <SnapshotContextWithDataRepository> ._)).Returns(_mappedDataColumn);
        }
Пример #3
0
        protected override void Context()
        {
            base.Context();
            _col1 = new DataColumn("col1", _mass, _baseGrid1)
            {
                Values   = new float[] { 10, 20, 30 },
                DataInfo = { Origin = ColumnOrigins.Observation }
            };
            _col2 = new DataColumn("col2", _mass, _baseGrid1)
            {
                Values   = new float[] { 100, 200, 300 },
                DataInfo = { AuxiliaryType = AuxiliaryType.ArithmeticStdDev, Origin = ColumnOrigins.ObservationAuxiliary }
            };

            _col1.AddRelatedColumn(_col2);
            _dataRepository.Add(_col2);
            _dataRepository.Add(_col1);
        }