コード例 #1
0
        protected override void Context()
        {
            _fakedTimeDimension = A.Fake <IDimension>();
            _fakedConcentrationDimensionMolar = A.Fake <IDimension>();
            _fakedConcentrationDimensionMass  = A.Fake <IDimension>();
            _fakedErrorDimension = A.Fake <IDimension>();
            _fakedImporter       = A.Fake <IImporter>();
            _fakeDataSet         = new DataSet();

            _columnInfos = new ColumnInfoCache
            {
                new ColumnInfo()
                {
                    DisplayName = "Time", Name = "Time"
                },
                new ColumnInfo()
                {
                    DisplayName = "Concentration", Name = "Concentration"
                },
                new ColumnInfo()
                {
                    DisplayName = "Error", Name = "Error", IsMandatory = false, RelatedColumnOf = "Concentration"
                }
            };

            _columnInfos["Time"].SupportedDimensions.Add(_fakedTimeDimension);
            _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimensionMolar);
            _columnInfos["Concentration"].SupportedDimensions.Add(_fakedConcentrationDimensionMass);
            _columnInfos["Error"].SupportedDimensions.Add(_fakedErrorDimension);
            _columnInfos["Error"].SupportedDimensions.Add(_fakedConcentrationDimensionMass);
            var parsedData = new Dictionary <ExtendedColumn, IList <SimulationPoint> >()
            {
                {
                    new ExtendedColumn()
                    {
                        Column = new Column()
                        {
                            Name = "Time",
                            Unit = new UnitDescription("s")
                        },
                        ColumnInfo = _columnInfos["Time"]
                    },
                    new List <SimulationPoint>()
                    {
                        new SimulationPoint()
                        {
                            Unit        = "s",
                            Measurement = 0,
                            Lloq        = double.NaN
                        },
                        new SimulationPoint()
                        {
                            Unit        = "s",
                            Measurement = 1,
                            Lloq        = double.NaN
                        },
                        new SimulationPoint()
                        {
                            Unit        = "s",
                            Measurement = 2,
                            Lloq        = double.NaN
                        }
                    }
                },
                {
                    new ExtendedColumn()
                    {
                        Column = new Column()
                        {
                            Name = "Concentration",
                            Unit = new UnitDescription("pmol/l")
                        },
                        ColumnInfo = _columnInfos["Concentration"]
                    },
                    new List <SimulationPoint>()
                    {
                        new SimulationPoint()
                        {
                            Unit        = "pmol/l",
                            Measurement = 10,
                            Lloq        = 1
                        },
                        new SimulationPoint()
                        {
                            Unit        = "pmol/l",
                            Measurement = 0.1,
                            Lloq        = 1
                        },
                        new SimulationPoint()
                        {
                            Unit        = "pmol/l",
                            Measurement = double.NaN,
                            Lloq        = 1
                        }
                    }
                },
                {
                    new ExtendedColumn()
                    {
                        Column = new Column()
                        {
                            Name = "Error",
                            Unit = new UnitDescription("")
                        },
                        ColumnInfo = _columnInfos["Error"]
                    },
                    new List <SimulationPoint>()
                    {
                        new SimulationPoint()
                        {
                            Unit        = "",
                            Measurement = 10,
                            Lloq        = 1
                        },
                        new SimulationPoint()
                        {
                            Unit        = "",
                            Measurement = 0.1,
                            Lloq        = 1
                        },
                        new SimulationPoint()
                        {
                            Unit        = "",
                            Measurement = double.NaN,
                            Lloq        = 1
                        }
                    }
                }
            };

            A.CallTo(() => _fakedTimeDimension.HasUnit("min")).Returns(true);
            A.CallTo(() => _fakedTimeDimension.HasUnit("s")).Returns(true);
            A.CallTo(() => _fakedConcentrationDimensionMolar.HasUnit("pmol/l")).Returns(true);
            A.CallTo(() => _fakedConcentrationDimensionMass.HasUnit("ng/ml")).Returns(true);
            A.CallTo(() => _fakedErrorDimension.HasUnit("pmol/l")).Returns(true);

            A.CallTo(() => _fakedConcentrationDimensionMolar.FindUnit("no unit", true)).Returns(null);
            A.CallTo(() => _fakedConcentrationDimensionMass.FindUnit("no unit", true)).Returns(null);
            A.CallTo(() => _fakedErrorDimension.FindUnit("no unit", true)).Returns(null);
            A.CallTo(() => _fakedConcentrationDimensionMolar.FindUnit("ng/ml", true)).Returns(null);
            A.CallTo(() => _fakedConcentrationDimensionMass.FindUnit("pmol/l", true)).Returns(null);

            _fakeDataSet.AddData(new List <ParsedDataSet>()
            {
                new ParsedDataSet(new List <string>(), A.Fake <DataSheet>(), new List <UnformattedRow>(),
                                  parsedData)
            });


            sut = new DataSource(_fakedImporter);
            sut.DataSets.Add("sheet1", _fakeDataSet);
        }