private void Transform_TestRunner_ExpectSuccess(string source, string transform, string baseline, string expectedLog)
        {
            string src                      = CreateATestFile("source.config", source);
            string transformFile            = CreateATestFile("transform.config", transform);
            string baselineFile             = CreateATestFile("baseline.config", baseline);
            string destFile                 = GetTestFilePath("result.config");
            TestTransformationLogger logger = new TestTransformationLogger();

            XmlTransformableDocument x = new XmlTransformableDocument();

            x.PreserveWhitespace = true;
            x.Load(src);

            Octopus.Web.XmlTransform.XmlTransformation xmlTransform = new Octopus.Web.XmlTransform.XmlTransformation(transformFile, logger);

            //execute
            bool succeed = xmlTransform.Apply(x);

            x.Save(destFile);
            xmlTransform.Dispose();
            x.Dispose();
            //test
            Assert.AreEqual(true, succeed);
            CompareFiles(baselineFile, destFile);
            CompareMultiLines(ReadResource(expectedLog), logger.LogText);
        }
        public void XmlTransform_Support_WriteToStream()
        {
            string src           = CreateATestFile("Web.config", "Web.config");
            string transformFile = CreateATestFile("Web.Release.config", "Web.Release.config");
            string destFile      = GetTestFilePath("MyWeb.config");

            //execute
            Octopus.Web.XmlTransform.XmlTransformableDocument x = new Octopus.Web.XmlTransform.XmlTransformableDocument();
            x.PreserveWhitespace = true;
            x.Load(src);

            Octopus.Web.XmlTransform.XmlTransformation transform = new Octopus.Web.XmlTransform.XmlTransformation(transformFile);

            bool succeed = transform.Apply(x);

            FileStream fsDestFile = new FileStream(destFile, FileMode.OpenOrCreate);

            x.Save(fsDestFile);

            //verify, we have a success transform
            Assert.AreEqual(true, succeed);

            //verify, the stream is not closed
            Assert.AreEqual(true, fsDestFile.CanWrite, "The file stream can not be written. was it closed?");

            //sanity verify the content is right, (xml was transformed)
            fsDestFile.Dispose();
            string content = File.ReadAllText(destFile);

            Assert.IsFalse(content.Contains("debug=\"true\""));

            List <string> lines = new List <string>(File.ReadLines(destFile));

            //sanity verify the line format is not lost (otherwsie we will have only one long line)
            Assert.IsTrue(lines.Count > 10);

            //be nice
            transform.Dispose();
            x.Dispose();
        }