Ejemplo n.º 1
0
        private string prepareExampleDirectory(out int numFiles)
        {
            var zipFile = Path.Combine(Directory.GetCurrentDirectory(), "specification.zip");
            var zip     = new ZipCacher(zipFile);
            var zipPath = zip.GetContentDirectory();

            var testPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(testPath);

            copy(zipPath, "extension-definitions.xml", testPath);
            copy(zipPath, "flag.xsd", testPath);
            copy(zipPath, "patient.sch", testPath);
            copy(@"TestData", "TestPatient.xml", testPath);
            File.WriteAllText(Path.Combine(testPath, "bla.dll"), "This is text, acting as a dll");
            File.WriteAllText(Path.Combine(testPath, "nonfhir.xml"), "<root>this is not a valid FHIR xml resource.</root>");
            File.WriteAllText(Path.Combine(testPath, "invalid.xml"), "<root>this is invalid xml");

            Directory.CreateDirectory(Path.Combine(testPath, "sub"));
            copy(@"TestData", "TestPatient.json", testPath);

            // If you add or remove files, please correct the numFiles here below
            numFiles = 8 - 1;   // 8 files - 1 binary (which should be ignored)

            return(testPath);
        }
Ejemplo n.º 2
0
        private string prepareExampleDirectory()
        {
            var zipFile = Path.Combine(Directory.GetCurrentDirectory(), "validation.xml.zip");
            var zip     = new ZipCacher(zipFile);
            var zipPath = zip.GetContentDirectory();

            var testPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());

            Directory.CreateDirectory(testPath);

            copy(zipPath, "extension-definitions.xml", testPath);
            copy(zipPath, "flag.xsd", testPath);
            copy(zipPath, "patient.sch", testPath);
            copy(@"TestData", "TestPatient.xml", testPath);
            File.WriteAllText(Path.Combine(testPath, "bla.dll"), "This is text, acting as a dll");

            Directory.CreateDirectory(Path.Combine(testPath, "sub"));
            copy(@"TestData", "TestPatient.json", testPath);

            return(testPath);
        }