/// <summary> /// The main. /// </summary> /// <param name="args"> /// The args. /// </param> public static void Main(string[] args) { IQueryParsingManager manager = new QueryParsingManager(SdmxSchemaEnumType.VersionTwo); IQueryWorkspace workspace; using (IReadableDataLocation location = new FileReadableDataLocation("QueryStructureRequest.xml")) { workspace = manager.ParseQueries(location); } if (workspace != null) { Console.WriteLine("Is Resolve references : {0}", workspace.ResolveReferences); Console.WriteLine("Has Structure Queries : {0}", workspace.HasStructureQueries()); if (workspace.HasStructureQueries()) { foreach (IStructureReference simpleStructureQuery in workspace.SimpleStructureQueries) { IMaintainableRefObject reference = simpleStructureQuery.MaintainableReference; Console.WriteLine( "Requested a {0}\n\tAgency ID: {1}\n\tId: {2}\n\tVersion: {3}", simpleStructureQuery.MaintainableStructureEnumType, reference.HasAgencyId() ? reference.AgencyId : "(none)", reference.HasMaintainableId() ? reference.MaintainableId : "(none)", reference.HasVersion() ? reference.Version : "(none)"); } } } }
public void TestQueryParserManagerV20(string file) { using (var fileReadableDataLocation = new FileReadableDataLocation(file)) { IQueryParsingManager queryParsingManager = new QueryParsingManager(SdmxSchemaEnumType.VersionTwo); IQueryWorkspace queryWorkspace = queryParsingManager.ParseQueries(fileReadableDataLocation); Assert.IsNotNull(queryWorkspace); Assert.IsNotEmpty(queryWorkspace.SimpleStructureQueries); } }
public void TestQueryParserManagerV20Deep(string file, SdmxStructureEnumType[] requests, bool resolveRefs) { using (var fileReadableDataLocation = new FileReadableDataLocation(file)) { IQueryParsingManager queryParsingManager = new QueryParsingManager(SdmxSchemaEnumType.VersionTwo); IQueryWorkspace queryWorkspace = queryParsingManager.ParseQueries(fileReadableDataLocation); Assert.IsNotNull(queryWorkspace); Assert.IsTrue(queryWorkspace.HasStructureQueries()); Assert.IsNotEmpty(queryWorkspace.SimpleStructureQueries); Assert.AreEqual(requests.Length, queryWorkspace.SimpleStructureQueries.Count); var expectedRequests = new LinkedList<SdmxStructureEnumType>(requests); Assert.AreEqual(resolveRefs, queryWorkspace.ResolveReferences); foreach (IStructureReference query in queryWorkspace.SimpleStructureQueries) { Assert.IsTrue(expectedRequests.Remove(query.MaintainableStructureEnumType.EnumType)); } } }