public void Convert(Project project) { if (!project.HasNUnitReference) { return; } Logger.Log($"Starting Convertion of project {Path.GetFileNameWithoutExtension(project.ProjectPath)}", ConsoleColor.Green); if (project.HasNUnitReference) { project.RemoveNUnitReference(); } if (!project.HasXUnitReference) { project.AddXUnitReference(); } Parallel.ForEach(project.Files, projectFile => { if (project.HasNUnitReference) { var rewriter = new Rewritter(); var fileConverter = new FileConverter(rewriter); fileConverter.Convert(projectFile); } }); }
public void TestAssertStatements() { var text = File.ReadAllText("From_Assert.txt"); var syntaxTree = CSharpSyntaxTree.ParseText(text); var root = syntaxTree.GetRoot(); var rewriter = new Rewritter(); root = rewriter.Visit(root); Assert.Equal(File.ReadAllText("To_Assert.txt"), FileConverter.Prettify(root)); }
static void Main(string[] args) { Logger.Init(); //var converter = new SolutionConverter(); //converter.Convert(@"C:\TTL\web\source\WebComponents\"); //converter.Convert(@"C:\TTL\web\source\WebComponents\DeliveryOptions\test\UnitTests"); //File convert FileRewritter fileRewritter = new Rewritter(); var converter = new FileConverter(fileRewritter); converter.Convert(@"C:\TTL\web\source\WebComponents\JourneyPlanning\test\UnitTests\Command"); Logger.Log("End ..."); System.Console.ReadLine(); }
public void Convert(Project project) { //if (!project.HasNSubstituteReference) ////{ //if (!project.HasRhinoMockReference) // return; //} Logger.Log($"Starting Convertion of project {Path.GetFileNameWithoutExtension(project.ProjectPath)}", ConsoleColor.Green); //if (project.HasRhinoMockReference) // project.RemoveRhinoMockReference(); //if (project.HasNSubstituteReference) // project.RemoveNSubstituteReference(); //if (!project.HasMoqReference) // project.AddMoqReference(); Parallel.ForEach(project.Files, projectFile => { FileRewritter rewriter; //if (project.HasNSubstituteReference) //{ // rewriter = new NSubstituteToMoq.Rewritter(); // var fileConverter = new FileConverter(rewriter); // fileConverter.Convert(projectFile); //} //if (project.HasRhinoMockReference) { rewriter = new Rewritter(); var fileConverter = new FileConverter(rewriter); fileConverter.Convert(projectFile); } }); }
public FileConverter(Rewritter syntaxRewriter) { _syntaxRewriter = syntaxRewriter; }