Esempio n. 1
0
        public void GenerateXmlAndXElementForSourceTest()
        {
            IFileMonitor watchedFolder = Substitute.For <IFileMonitor>();

            var archive = new SrcMLArchive(watchedFolder, ".srcml");

            archive.XmlGenerator.ApplicationDirectory = TestConstants.SrcmlPath;
            var xmlDirectory = new DirectoryInfo(archive.ArchivePath);

            File.WriteAllText(SOURCEDIRECTORY + "\\foo.c", String.Format(@"int foo() {{{0}printf(""hello world!"");{0}}}", Environment.NewLine));
            File.WriteAllText(SOURCEDIRECTORY + "\\bar.c", String.Format(@"int bar() {{{0}    printf(""goodbye, world!"");{0}}}", Environment.NewLine));

            XElement fooXElement = archive.GenerateXmlAndXElementForSource(SOURCEDIRECTORY + "\\foo.c");
            XElement barXElement = archive.GenerateXmlAndXElementForSource(SOURCEDIRECTORY + "\\bar.c");

            Assert.IsNotNull(fooXElement);
            Assert.IsNotNull(barXElement);
            Assert.That(File.Exists(Path.Combine(xmlDirectory.FullName, "2BVUHCFVS6KX3VHC6BBBWFADSZ7EY7FRH48CX7GV627VYYGVEC9WXVFCB8UMWXJSVCGESVDEH4MUXBG4WCJWNM9RKZ9CNJGV6M8C3JFRS2GBXJG4X88LX7RR.xml")));
            Assert.That(File.Exists(Path.Combine(xmlDirectory.FullName, "2BVUHCFVS6KX3VHC6BBBWFADSZ7EY7FRH48CX7GV627VYYGVEC9WXVFCB8UMWXJSVCGESVDEH4MUXBG4WCJWNM9RKZ9CNJGV6M8C3JFRS2GBXJG4Z4UW37RR.xml")));
        }