本文整理汇总了C#中ICSharpCode.RubyBinding.NRefactoryToRubyConverter.Convert方法的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryToRubyConverter.Convert方法的具体用法?C# NRefactoryToRubyConverter.Convert怎么用?C# NRefactoryToRubyConverter.Convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICSharpCode.RubyBinding.NRefactoryToRubyConverter
的用法示例。
在下文中一共展示了NRefactoryToRubyConverter.Convert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby =
"class Class1\r\n" +
" def initialize()\r\n" +
" @name = String.Empty\r\n" +
" @lastName = String.Empty\r\n" +
" end\r\n" +
"\r\n" +
" def Name\r\n" +
" return @name\r\n" +
" end\r\n" +
"\r\n" +
" def Name=(value)\r\n" +
" @name = value\r\n" +
" end\r\n" +
"\r\n" +
" def LastName\r\n" +
" return @lastName\r\n" +
" end\r\n" +
"\r\n" +
" def LastName=(value)\r\n" +
" @lastName = value\r\n" +
" end\r\n" +
"\r\n" +
" def Clone()\r\n" +
" return Class1.new(Name = \"First\", LastName = \"Last\")\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby, Ruby);
}
示例2: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby =
"# <summary>\r\n" +
"# Class Foo\r\n" +
"# </summary>\r\n" +
"class Foo\r\n" +
" # <summary>\r\n" +
" # Run\r\n" +
" # </summary>\r\n" +
" def Run()\r\n" +
" end\r\n" +
"\r\n" +
" # <summary> Stop </summary>\r\n" +
" def Stop()\r\n" +
" end\r\n" +
"\r\n" +
" # <summary> Initialize.</summary>\r\n" +
" def initialize()\r\n" +
" # Initialize j.\r\n" +
" j = 0 # Set to zero\r\n" +
" # test\r\n" +
" if j == 0 then\r\n" +
" j = 2\r\n" +
" end\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby, Ruby);
}
示例3: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby =
"class Foo\r\n" +
" def initialize()\r\n" +
" @count = 0\r\n" +
" @i = 0\r\n" +
" end\r\n" +
"\r\n" +
" def Count\r\n" +
" if @i == 0 then\r\n" +
" return 10\r\n" +
" else\r\n" +
" return @count\r\n" +
" end\r\n" +
" end\r\n" +
"\r\n" +
" def Count=(value)\r\n" +
" if @i == 1 then\r\n" +
" @count = value\r\n" +
" else\r\n" +
" @count = value + 5\r\n" +
" end\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
示例4: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby =
"class Foo\r\n" +
" def initialize()\r\n" +
" @count = 0\r\n" +
" end\r\n" +
"\r\n" +
" def Count\r\n" +
" return @count\r\n" +
" end\r\n" +
"\r\n" +
" def Increment()\r\n" +
" self.Count += 1\r\n" +
" end\r\n" +
"\r\n" +
" def SetCount(Count)\r\n" +
" self.Count = Count\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby, Ruby);
}
示例5: GeneratedMainMethodCallWithNoParametersCode
public void GeneratedMainMethodCallWithNoParametersCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
converter.Convert(mainMethodWithNoParametersCode);
string code = converter.GenerateMainMethodCall(converter.EntryPointMethods[0]);
Assert.AreEqual("Foo.Main()", code);
}
示例6: MultiplyOperator
public void MultiplyOperator()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(GetCode(csharp, "*="));
string expectedRuby = GetCode(RubyCodeTemplate, "*=");
Assert.AreEqual(expectedRuby, Ruby);
}
示例7: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
string Ruby = converter.Convert(csharp);
string expectedRuby = "class Foo\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
示例8: ConvertedRubyCode
public void ConvertedRubyCode()
{
string expectedCode =
"class Foo < Bar, IMyInterface\r\n" +
"end";
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string code = converter.Convert(csharp);
Assert.AreEqual(expectedCode, code);
}
示例9: GeneratedRubyCode
public void GeneratedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
string Ruby = converter.Convert(csharp);
string expectedRuby = "require \"mscorlib\"\r\n" +
"require \"System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" +
"\r\n" +
"class Foo\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
示例10: Convert
public static bool Convert(SupportedLanguage inputLanguage, string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
NRefactoryToRubyConverter converter = new
NRefactoryToRubyConverter(inputLanguage);
string convertedCode = converter.Convert(ProvidedSource);
ConvertedSource = convertedCode;
ErrorMessage = "";
return true;
}
示例11: GeneratedRubyCode
public void GeneratedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby = "class Foo\r\n" +
" def Init()\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
示例12: ConvertedRubyCode
public void ConvertedRubyCode()
{
string expectedCode = "class Foo\r\n" +
" def Run()\r\n" +
" raise XmlException.new()\r\n" +
" end\r\n" +
"end";
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string code = converter.Convert(csharp);
Assert.AreEqual(expectedCode, code);
}
示例13: GeneratedRubySourceCode
public void GeneratedRubySourceCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet);
converter.IndentString = " ";
string Ruby = converter.Convert(vb);
string expectedRuby =
"module DefaultNamespace\r\n" +
" class Class1\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
示例14: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby =
"class Foo\r\n" +
" def IsEqual(o)\r\n" +
" return System::Object.ReferenceEquals(o, nil)\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby, Ruby);
}
示例15: ConvertedRubyCode
public void ConvertedRubyCode()
{
NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string Ruby = converter.Convert(csharp);
string expectedRuby = "class Foo\r\n" +
" def TestMe(test)\r\n" +
" a = test ? \"Ape\" : \"Monkey\"\r\n" +
" return a\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}