public void TestWritingIncludeGuard()
        {
            var writer = new CHeaderFileWriter() { IncludeGuard = "test" };

            using (var stream = new MemoryStream())
            {
                writer.WriteHeaderFile(new CSourceFile(), stream);
                var bytes = stream.ToArray();
                var str = Encoding.ASCII.GetString(bytes);

                Assert.That(str, Is.Not.Null.And.EqualTo("#ifndef test\r\n#define test\r\n\r\n\r\n#endif\r\n"));
            }
        }
        public void TestWritingHeaderComment()
        {
            var writer = new CHeaderFileWriter() { HeaderComment = "test" };

            using (var stream = new MemoryStream())
            {
                writer.WriteHeaderFile(new CSourceFile(), stream);
                var bytes = stream.ToArray();
                var str = Encoding.ASCII.GetString(bytes);

                Assert.That(str, Is.Not.Null.And.EqualTo("test\r\n\r\n"));
            }
        }
        /// <summary>
        /// Writer the parsed source file to the output file
        /// </summary>
        /// <param name="showIncludeGuard">Whether to surround the header file in an include guard</param>
        /// <param name="codeWriter">The code writer object</param>
        /// <param name="headerFileName">The name of the header file to produce</param>
        /// <param name="c">The parse source file</param>
        private static void WriteToHeaderFile(bool showIncludeGuard, CHeaderFileWriter codeWriter, string headerFileName, CSourceFile c)
        {
            if (showIncludeGuard)
                codeWriter.IncludeGuard = new Regex(@"[^A-Z0-9_]").Replace(string.Format("__{0}__",
                    Path.GetFileName(headerFileName).ToUpperInvariant()), "_");
            else
                codeWriter.IncludeGuard = null;

            using (var stream = File.Open(headerFileName, FileMode.Create))
            {
                codeWriter.WriteHeaderFile(c, stream);
            }
        }