Ejemplo n.º 1
0
        public void Transform_ValidDataHandHarvestYieldV1_ReturnsExpected()
        {
            // Arrange

            CosmosDBSqlApiSampleV2Transformer
            <HandHarvestYieldV1, VegetationSample> sut =
                new CosmosDBSqlApiSampleV2Transformer
                <HandHarvestYieldV1, VegetationSample>(
                    new MapFromHandHarvestYieldV1ToVegetationSample(),
                    "http://files.cafltar.org/data/schema/documentDb/v2/sample.json",
                    "",
                    "CookEastCropHandHarvest",
                    "CookEast",
                    "VegetationSample");

            TidyData tidyData =
                ManualArranger.GetTidyDataDerivedFromActualDataV1();

            List <VegetationSample> expected =
                ManualArranger.GeHandHarvestSampleDerivedFromActualDataV1();

            // Act
            List <VegetationSample> actual = new List <VegetationSample>()
            {
                sut.Transform(tidyData).First()
            };

            // Assert
            Assert.Equal(expected.Count, actual.Count);
            Assert.True(ComparerUtil.AreVegetationSamplesRoughlyEqual(
                            expected, actual));
        }
Ejemplo n.º 2
0
        public void Extract_ValidData_ReturnsExpected()
        {
            // Arrange
            TidyDataCsvExtractor sut = new TidyDataCsvExtractor(
                pathToFileWithValidDataSlimV1,
                pathToFileWithValidDictionaryV1);
            TidyData expected = ManualArranger
                                .GetTidyDataDerivedFromActualDataV1();

            // Act
            TidyData actual = sut.Extract <HandHarvestYieldV1>();

            // Assert
            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void LoadToFile_ValidData_WritesFile()
        {
            // Arrange
            var    sut      = new TidyDataCsvLoader();
            var    tidyData = ManualArranger.GetTidyDataDerivedFromActualDataV1();
            string dirPath  = @"Assets\Output";

            // Act
            sut.LoadToFile(tidyData, dirPath, "test");

            // Assert
            var files = Directory.GetFiles(dirPath, "test*");

            Assert.Equal(2, files.Length);

            // Cleanup
            if (files.Length > 0)
            {
                foreach (var file in files)
                {
                    File.Delete(file);
                }
            }
        }