Пример #1
0
        public void Write_all_text_writes_root()
        {
            const string fileName   = "temp.cs";
            var          csharpCode = @"
                        using System.Diagnostics.Tracing;
                        namespace Namespace1
                        { }";
            IRoot        root       = RDom.CSharp.Load(csharpCode);

            Assert.IsNotNull(root);
            UpdateUtilities.WriteToFile(fileName, root);
            File.Exists(fileName);
            var actual = File.ReadAllText(fileName);

            Assert.AreEqual(csharpCode, actual);
        }
Пример #2
0
        public void Write_all_text_writes_root_to_new_directory()
        {
            const string dirName  = "TempTestDir";
            string       fileName = Path.Combine(dirName, "temp.cs");

            if (Directory.Exists(dirName))
            {
                Directory.Delete(dirName, true);
            }
            var   csharpCode = @"
                        using System.Diagnostics.Tracing;
                        namespace Namespace1
                        { }";
            IRoot root       = RDom.CSharp.Load(csharpCode);

            Assert.IsNotNull(root);
            UpdateUtilities.WriteToFile(fileName, root);
            File.Exists(fileName);
            var actual = File.ReadAllText(fileName);

            Assert.AreEqual(csharpCode, actual);
        }