string Convert(string unitFileName, string delphiCode) { CodeBase codeBase = new CodeBase(CompilerDefines.CreateEmpty(), new MemoryFileLoader()); codeBase.AddFileExpectingSuccess(unitFileName, delphiCode); return(new ToCSharpVisitor().Convert(codeBase)); }
protected IList<Hit> HitsFor(params string[] text) { List<string> unit = new List<string>(); AddPrefix(unit); unit.AddRange(text); AddSuffix(unit); string joinedText = String.Join(Environment.NewLine, unit.ToArray()); CodeBase codeBase = new CodeBase(CompilerDefines.CreateEmpty(), new MemoryFileLoader()); codeBase.AddFileExpectingSuccess("Foo.pas", joinedText); return CreateAction().Execute(codeBase); }
protected IList <Hit> HitsFor(params string[] text) { List <string> unit = new List <string>(); AddPrefix(unit); unit.AddRange(text); AddSuffix(unit); string joinedText = String.Join(Environment.NewLine, unit.ToArray()); CodeBase codeBase = new CodeBase(CompilerDefines.CreateEmpty(), new MemoryFileLoader()); codeBase.AddFileExpectingSuccess("Foo.pas", joinedText); return(CreateAction().Execute(codeBase)); }
public void AddFileExpectingSuccessWithSuccess() { _codeBase.AddFileExpectingSuccess("Foo.pas", "unit Foo; interface implementation end."); Assert.That(_codeBase.ParsedFileCount, Is.EqualTo(1)); }