Example #1
0
        public void GenerateXmlForSourceTest()
        {
            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));

            archive.GenerateXmlForSource(SOURCEDIRECTORY + "\\foo.c");
            archive.GenerateXmlForSource(SOURCEDIRECTORY + "\\bar.c");

            Assert.That(File.Exists(Path.Combine(xmlDirectory.FullName, "foo.c.xml")));
            Assert.That(File.Exists(Path.Combine(xmlDirectory.FullName, "bar.c.xml")));
        }