Пример #1
0
        public void TestRdfLoaderGetMeasures()
        {
            // Arrange

            // Act
            var measures = _testee.GetMeasures(BusinessLayerTestHelper.DatasetName).ToList();

            // Assert
            measures.Count().ShouldBeEquivalentTo(1);
            measures[0].Name.ShouldBeEquivalentTo("amount");
        }
        public void CreateDataset(string userId, int id, HttpPostedFileBase dsdFile)
        {
            var dataset   = Data.GetDataset(id);
            var file      = _fileHandler.SaveFile(dsdFile, string.Empty);
            var rdfLoader = new RdfLoader(file.FilePath, Data.GetCsvFilePath(userId, id));
            // Check names for Sql safety
            var dimensionDtos = rdfLoader.GetDimensions(dataset.Name).ToList();
            var measureDtos   = rdfLoader.GetMeasures(dataset.Name).ToList();
            var dimensions    = DimensionMapper.ConvertToDimensions(dimensionDtos);
            var measures      = measureDtos.Select(d => d.ConvertToMeasure()).ToList();
            var data          = rdfLoader.ConvertObservationsToDataTable(dimensionDtos, measureDtos);

            BuildStarSchema(id, data, dimensions, measures);
        }
Пример #3
0
        public void TestRdfLoaderGetDataWithHierarchies()
        {
            // Arrange

            // Act
            var dimensions = _testeeWithHierarchies.GetDimensions(BusinessLayerTestHelper.DatasetName).ToList();
            var measures   = _testeeWithHierarchies.GetMeasures(BusinessLayerTestHelper.DatasetName).ToList();
            var data       = _testeeWithHierarchies.ConvertObservationsToDataTable(dimensions, measures);

            // Assert
            data.Rows.Count.ShouldBeEquivalentTo(1);
            data.Rows[0]["Date"].ShouldBeEquivalentTo(new DateTime(2016, 1, 1));
            data.Rows[0]["Month"].ShouldBeEquivalentTo(new DateTime(2016, 1, 1));
            data.Rows[0]["Product"].ShouldBeEquivalentTo("Bread");
            data.Rows[0]["Category"].ShouldBeEquivalentTo("Bakery");
            data.Rows[0]["Country"].ShouldBeEquivalentTo("CZ");
            data.Rows[0]["Region"].ShouldBeEquivalentTo("EU");
            data.Rows[0]["Units_sold"].ShouldBeEquivalentTo(9);
            data.Rows[0]["Value_of_units_sold"].ShouldBeEquivalentTo(180);
        }