public void Test(string file)
 {
     IDataStructureObject dsd = BuildDsd();
     IReportedDateEngine reportedDateEngine = new ReportedDateEngine();
     var sdmxDataReaderFactory = new SdmxDataReaderFactory(new DataInformationManager(new FixedConceptEngine(), reportedDateEngine), new EdiParseManager());
     using (var sourceData = this._factory.GetReadableDataLocation(new FileInfo(file)))
     using (var dataReaderEngine = sdmxDataReaderFactory.GetDataReaderEngine(sourceData, dsd, null))
     {
         Assert.NotNull(dataReaderEngine);
         IHeader header = dataReaderEngine.Header;
         Assert.NotNull(header);
         Assert.IsTrue(dataReaderEngine.MoveNextDataset());
         Assert.IsTrue(dataReaderEngine.MoveNextKeyable());
         Assert.AreEqual("Q", dataReaderEngine.CurrentKey.GetKeyValue("FREQ"));
         Assert.AreEqual("N", dataReaderEngine.CurrentKey.GetKeyValue("ADJUSTMENT"));
         Assert.AreEqual("A", dataReaderEngine.CurrentKey.GetKeyValue("STS_ACTIVITY"));
         Assert.IsTrue(dataReaderEngine.MoveNextObservation());
         Assert.AreEqual("2005-Q1", dataReaderEngine.CurrentObservation.ObsTime);
     }
 }
 public void TestCrossWriterNoXSMeasureWithOutTime()
 {
     ICrossSectionalDataStructureObject crossSectionalDataStructureObject = BuildCrossDsdNoTime();
     var fileInfo = new FileInfo("cross-TestCrossWriterNoXSMeasureWithOutTime.xml");
     WriteCrossDataNoTime(fileInfo.ToString(), crossSectionalDataStructureObject);
     IReportedDateEngine reportedDateEngine = new ReportedDateEngine();
     var sdmxDataReaderFactory = new SdmxDataReaderFactory(new DataInformationManager(new FixedConceptEngine(), reportedDateEngine), null);
     using (var sourceData = this._factory.GetReadableDataLocation(fileInfo))
     using (var dataReaderEngine = sdmxDataReaderFactory.GetDataReaderEngine(sourceData, crossSectionalDataStructureObject, null))
     {
         Assert.NotNull(dataReaderEngine);
         Assert.NotNull(dataReaderEngine.Header);
         Assert.IsTrue(dataReaderEngine.MoveNextDataset());
         Assert.IsTrue(dataReaderEngine.MoveNextKeyable());
         Assert.AreEqual("Q", dataReaderEngine.CurrentKey.GetKeyValue("FREQ"));
         Assert.AreEqual("N", dataReaderEngine.CurrentKey.GetKeyValue("ADJUSTMENT"));
         Assert.AreEqual("A", dataReaderEngine.CurrentKey.GetKeyValue("STS_ACTIVITY"));
         Assert.IsTrue(dataReaderEngine.MoveNextObservation());
         IObservation currentObservation = dataReaderEngine.CurrentObservation;
         Assert.IsNotNull(currentObservation);
         Assert.IsNotNullOrEmpty(currentObservation.ObservationValue);
     }
 }
        public void TestDimAtObs(string file, string dimAtObs)
        {
            IDataStructureObject dsd = BuildDsd();
            IReportedDateEngine reportedDateEngine = new ReportedDateEngine();
            var sdmxDataReaderFactory = new SdmxDataReaderFactory(new DataInformationManager(new FixedConceptEngine(), reportedDateEngine), null);
            using (var sourceData = this._factory.GetReadableDataLocation(new FileInfo(file)))
            using (var dataReaderEngine = sdmxDataReaderFactory.GetDataReaderEngine(sourceData, dsd, null))
            {
                Assert.NotNull(dataReaderEngine);
                Assert.NotNull(dataReaderEngine.Header);
                Assert.IsTrue(dataReaderEngine.MoveNextDataset());
                Assert.IsTrue(dataReaderEngine.MoveNextKeyable());
                IKeyable currentKey = dataReaderEngine.CurrentKey;

                Assert.IsTrue(dataReaderEngine.MoveNextObservation());
                var currentObs = dataReaderEngine.CurrentObservation;
                if (!dimAtObs.Equals("FREQ"))
                {
                    Assert.AreEqual("A", currentKey.GetKeyValue("FREQ"));
                }
                else
                {
                    Assert.AreEqual("A", currentObs.CrossSectionalValue.Code);
                }

                if (!dimAtObs.Equals("ADJUSTMENT"))
                {
                    Assert.AreEqual("N", currentKey.GetKeyValue("ADJUSTMENT"));
                }
                else
                {
                    Assert.AreEqual("N", currentObs.CrossSectionalValue.Code);
                }

                if (!dimAtObs.Equals("STS_ACTIVITY"))
                {
                    Assert.AreEqual("A", currentKey.GetKeyValue("STS_ACTIVITY"));
                }
                else
                {
                    Assert.AreEqual("A", currentObs.CrossSectionalValue.Code);
                }

                Assert.AreEqual("2005", dataReaderEngine.CurrentObservation.ObsTime);
            }
        }
        public void TestFull(string file, string dsd)
        {
            var retrievalManager = new InMemoryRetrievalManager();
            IDataStructureObject dsdObject;
            using (IReadableDataLocation dataLocation = _factory.GetReadableDataLocation(new FileInfo(dsd)))
            {
                IStructureParsingManager manager = new StructureParsingManager();
                var structureWorkspace = manager.ParseStructures(dataLocation);
                retrievalManager.SaveStructures(structureWorkspace.GetStructureObjects(false));

            }

            IReportedDateEngine reportedDateEngine = new ReportedDateEngine();
            var sdmxDataReaderFactory = new SdmxDataReaderFactory(new DataInformationManager(new FixedConceptEngine(), reportedDateEngine), null);
            using (var sourceData = this._factory.GetReadableDataLocation(new FileInfo(file)))
            using (var dataReaderEngine = sdmxDataReaderFactory.GetDataReaderEngine(sourceData, retrievalManager))
            {
                while (dataReaderEngine.MoveNextDataset())
                {
                    while (dataReaderEngine.MoveNextKeyable())
                    {
                        IKeyable currentKey = dataReaderEngine.CurrentKey;
                        if (currentKey.Series)
                        {
                            while (dataReaderEngine.MoveNextObservation())
                            {
                                
                            }
                        }
                    }
                }
            }
        }
 public void TestHeaderIsTest(string file, bool expectedValue)
 {
     IDataStructureObject dsd = BuildDsd();
     IReportedDateEngine reportedDateEngine = new ReportedDateEngine();
     var sdmxDataReaderFactory = new SdmxDataReaderFactory(new DataInformationManager(new FixedConceptEngine(), reportedDateEngine), new EdiParseManager());
     using (var sourceData = this._factory.GetReadableDataLocation(new FileInfo(file)))
     using (var dataReaderEngine = sdmxDataReaderFactory.GetDataReaderEngine(sourceData, dsd, null))
     {
         Assert.NotNull(dataReaderEngine);
         IHeader header = dataReaderEngine.Header;
         Assert.NotNull(header);
         Assert.AreEqual(expectedValue, header.Test);
     }
 }