Ejemplo n.º 1
0
        public void ToMeasurement_ValidDataMetV2_ReturnCorrectMeasurementsV2()
        {
            //# Arrange
            MapFromToa5DataTableToCafStandards map =
                new MapFromToa5DataTableToCafStandards();
            TOA5 toa5 = LoggerNetArranger.GetToa5MeteorologyDerivedFromActualDataV2();

            List <MeasurementV2> expected =
                LoggerNetArranger.GetMeasurementsV2DerivedFromActualDataMeteorologyV2();

            CosmosDBSqlApiV2Transformer sut =
                new CosmosDBSqlApiV2Transformer(
                    map,
                    "http://files.cafltar.org/data/schema/documentDb/v2/measurement.json",
                    "CosmosDBSqlApiTransformer",
                    "Measurement",
                    "CafMeteorologyEcTower",
                    900);

            //# Act
            var actual = sut.ToMeasurements(toa5);

            //# Assert
            Assert.Equal(expected.Count, actual.Count);
            Assert.True(ComparerUtil.AreMeasurementsRoughlyEqual(expected, actual));
        }
Ejemplo n.º 2
0
        public void GetTOA5_ValidContentV1_ReturnsCorrectTOA5()
        {
            TOA5Extractor       sut = new TOA5Extractor(pathToFileWithValidContentV1);
            List <IObservation> expectedObservations =
                LoggerNetArranger.GetFluxObservationsDerivedFromActualDataV1();

            TOA5 fluxTable = sut.GetTOA5(new Flux());

            Assert.Equal(expectedObservations, fluxTable.Observations);
            //TODO: Test actual metadata
        }
        public void Transform_GenericHasLessPropertiesThanMeasurements_ReturnsOnlyGenericProperties()
        {
            // Arrange
            List <MeasurementV2> measurements = LoggerNetArranger.GetMeasurementV2TwoVariablesMultipleTimesteps();
            var sut = new ManualTidyDataTransformer();

            // Act
            TidyData actual = sut.Transform <DataTableOneVar>(measurements);

            // Assert
            Assert.Equal(3, actual.Observations.Count);
            Assert.Equal(2, actual.Metadata.Variables.Count);
        }
Ejemplo n.º 4
0
        public void GetTOA5_TestContentV2_ReturnsCorrectTOA5()
        {
            // Arrange
            TOA5 expected =
                LoggerNetArranger.GetToa5FluxDerivedFromTestDataV2();
            TOA5Extractor sut = new TOA5Extractor(
                pathToFileWithTestLoggerOutputV2);

            // Act
            TOA5 actual = sut.GetTOA5(new Flux());

            // Assert
            Assert.Equal(expected, actual);
        }
Ejemplo n.º 5
0
        public void GetTOA5_ActualContentV2_ReturnsCorrectTOA5()
        {
            // Arrange
            TOA5 expected =
                LoggerNetArranger.GetToa5MeteorologyDerivedFromActualDataV2();
            TOA5Extractor sut = new TOA5Extractor(
                pathToFileWithActualLoggerOutputV2);

            // Act
            TOA5 actual = sut.GetTOA5(new Meteorology());

            // Assert
            Assert.Equal(expected, actual);
        }
Ejemplo n.º 6
0
        public void GetObservations_TestContentV2_ReturnsCorrectObservations()
        {
            //# Arrange
            List <IObservation> expectedObservations =
                LoggerNetArranger.GetFluxObservationsDerivedFromTestDataV2();
            List <IObservation> actualObservations = new List <IObservation>();
            TOA5Extractor       sut = new TOA5Extractor(pathToFileWithTestLoggerOutputV2);

            //# Act
            actualObservations = sut.GetObservations(new Flux())
                                 .Cast <IObservation>()
                                 .ToList();

            //# Assert
            Assert.Equal(expectedObservations[0], actualObservations[0]);
        }
Ejemplo n.º 7
0
        public void GetObservations_ValidContentV1_ReturnsCorrectObservations()
        {
            //# Arrange
            List <IObservation> expectedObservations =
                LoggerNetArranger.GetFluxObservationsDerivedFromActualDataV1();
            List <IObservation> actualObservations = new List <IObservation>();
            TOA5Extractor       sut = new TOA5Extractor(pathToFileWithValidContentV1);

            //# Act
            actualObservations = sut.GetObservations <Flux>()
                                 .Cast <IObservation>()
                                 .ToList();

            //# Assert
            Assert.Equal(expectedObservations[0], actualObservations[0]);
        }
        public void Transform_ValidData_ExpectedResults()
        {
            // Arrange
            List <MeasurementV2> measurements = LoggerNetArranger.GetMeasurementV2TwoVariablesMultipleTimesteps();
            var sut = new ManualTidyDataTransformer();

            // Act
            TidyData actual = sut.Transform <DataTableTwoVar>(measurements);

            // Assert
            List <DataTableTwoVar> actualObs = actual.Observations.Cast <DataTableTwoVar>().ToList();

            Assert.Equal(3, actual.Observations.Count);
            Assert.Equal(3, actual.Metadata.Variables.Count);
            Assert.NotNull(actualObs.Where(m => m.ParDensityTsAvg == 1806.077).FirstOrDefault());
        }