Ejemplo n.º 1
0
        public void TestSerializeRewriteCodeFolder()
        {
            var rc       = new RewriteCodeFolder(".", "*.cs");
            var text     = rc.SerializeMe();
            var newClass = RewriteAction.UnSerializeMe(text) as RewriteCodeFolder;

            Assert.IsNotNull(newClass);
            //File.WriteAllText("a.txt", text);
            //Process.Start("notepad.exe", "a.txt");
            Assert.AreEqual(rc.FolderName, newClass.FolderName);
        }
Ejemplo n.º 2
0
        public void TestSerializeRewriteCodeFolderFormatter()
        {
            var rc = new RewriteCodeFolder(".", "*.cs");

            rc.Formatter.FormatterFirstLine = "System.Console.WriteLine('andrei ignat')";
            var text     = rc.SerializeMe();
            var newClass = RewriteAction.UnSerializeMe(text) as RewriteCodeFolder;

            Assert.IsNotNull(newClass);
            //File.WriteAllText("a.txt", text);
            //Process.Start("notepad.exe", "a.txt");
            rc.Formatter.FormatterFirstLine.ShouldBe(newClass.Formatter.FormatterFirstLine);
        }
Ejemplo n.º 3
0
 public void TestSerializeRewriteCodeFile()
 {
     #region arrange
     var rc = new RewriteCodeFile("andrei.cs");
     #endregion
     #region act
     var text     = rc.SerializeMe();
     var newClass = RewriteAction.UnSerializeMe(text) as RewriteCodeFile;
     #endregion
     #region assert
     Assert.IsNotNull(newClass);
     Assert.AreEqual(rc.FileName, newClass.FileName);
     #endregion
 }
Ejemplo n.º 4
0
        private int OnExecute()
        {
            Console.WriteLine($"processing files accordingly to settings from {Name}");
            var i       = new Interpret();
            var text    = i.InterpretText(File.ReadAllText(Name));
            var rewrite = RewriteAction.UnSerializeMe(text);

            rewrite.Rewrite();
            return(0);
            //for (var i = 0; i < Count; i++)
            //{
            //    Console.WriteLine($"Hello {Name}!");
            //}
            //return 0;
        }