本文整理汇总了C#中ICSharpCode.PythonBinding.NRefactoryToPythonConverter类的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryToPythonConverter类的具体用法?C# NRefactoryToPythonConverter怎么用?C# NRefactoryToPythonConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NRefactoryToPythonConverter类属于ICSharpCode.PythonBinding命名空间,在下文中一共展示了NRefactoryToPythonConverter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef __init__(self):\r\n" +
"\t\tself._i = 0\r\n" +
"\r\n" +
"\tdef GetCount(self):\r\n" +
"\t\tif self._i == 0:\r\n" +
"\t\t\tif self._i == 0:\r\n" +
"\t\t\t\tself._i = 10\r\n" +
"\t\t\t\treturn 10\r\n" +
"\t\t\telse:\r\n" +
"\t\t\t\tself._i = 4\r\n" +
"\t\t\t\treturn 4\r\n" +
"\t\telse:\r\n" +
"\t\t\tif self._i == 0:\r\n" +
"\t\t\t\tself._i = 10\r\n" +
"\t\t\t\treturn 10\r\n" +
"\t\t\telse:\r\n" +
"\t\t\t\tself._i = 4\r\n" +
"\t\t\t\treturn 4";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:26,代码来源:NestedIfStatementConversionTestFixture.cs
示例2: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
" \"\"\" <summary>\r\n" +
" Class Foo\r\n" +
" </summary>\r\n" +
" \"\"\"\r\n" +
" def Run(self):\r\n" +
" \"\"\" <summary>\r\n" +
" Run\r\n" +
" </summary>\r\n" +
" \"\"\"\r\n" +
" pass\r\n" +
"\r\n" +
" def Stop(self):\r\n" +
" \"\"\" <summary> Stop </summary>\"\"\"\r\n" +
" pass\r\n" +
"\r\n" +
" def __init__(self):\r\n" +
" \"\"\" <summary> Initialize.</summary>\"\"\"\r\n" +
" # Initialize j.\r\n" +
" j = 0 # Set to zero\r\n" +
" # test\r\n" +
" if j == 0:\r\n" +
" j = 2";
Assert.AreEqual(expectedPython, python, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:31,代码来源:XmlDocCommentConversionTestFixture.cs
示例3: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Class1(object):\r\n" +
"\tdef __init__(self):\r\n" +
"\t\tself._name = String.Empty\r\n" +
"\t\tself._lastName = String.Empty\r\n" +
"\r\n" +
"\tdef get_Name(self):\r\n" +
"\t\treturn self._name\r\n" +
"\r\n" +
"\tdef set_Name(self, value):\r\n" +
"\t\tself._name = value\r\n" +
"\r\n" +
"\tName = property(fget=get_Name, fset=set_Name)\r\n" +
"\r\n" +
"\tdef get_LastName(self):\r\n" +
"\t\treturn self._lastName\r\n" +
"\r\n" +
"\tdef set_LastName(self, value):\r\n" +
"\t\tself._lastName = value\r\n" +
"\r\n" +
"\tLastName = property(fget=get_LastName, fset=set_LastName)\r\n" +
"\r\n" +
"\tdef Clone(self):\r\n" +
"\t\treturn Class1(Name = \"First\", LastName = \"Last\")";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:30,代码来源:ObjectInitializerConversionTestFixture.cs
示例4: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef __init__(self):\r\n" +
"\t\tself._count = 0\r\n" +
"\t\tself._i = 0\r\n" +
"\r\n" +
"\tdef get_Count(self):\r\n" +
"\t\tif self._i == 0:\r\n" +
"\t\t\treturn 10\r\n" +
"\t\telse:\r\n" +
"\t\t\treturn self._count\r\n" +
"\r\n" +
"\tdef set_Count(self, value):\r\n" +
"\t\tif self._i == 1:\r\n" +
"\t\t\tself._count = value\r\n" +
"\t\telse:\r\n" +
"\t\t\tself._count = value + 5\r\n" +
"\r\n" +
"\tCount = property(fget=get_Count, fset=set_Count)";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:25,代码来源:PropertyWithGetSetStatementsTestfixture.cs
示例5: GeneratedPythonSourceCode
public void GeneratedPythonSourceCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n\tpass";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:8,代码来源:CSharpClassWithNamespaceConversionTestFixture.cs
示例6: GeneratedMainMethodCallWithNoParametersCode
public void GeneratedMainMethodCallWithNoParametersCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
converter.Convert(mainMethodWithNoParametersCode);
string code = converter.GenerateMainMethodCall(converter.EntryPointMethods[0]);
Assert.AreEqual("Foo.Main()", code);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:GenerateMainMethodCallTestFixture.cs
示例7: DivideOperator
public void DivideOperator()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(GetCode(csharp, "/="));
string expectedPython = GetCode(pythonCodeTemplate, "/=");
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:8,代码来源:AssignmentOperatorConversionTestFixture.cs
示例8: GeneratedPythonSourceCode
public void GeneratedPythonSourceCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet);
string python = converter.Convert(vb);
string expectedPython = "class Class1(object):\r\n" +
"\tpass";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:9,代码来源:VBClassConversionTestFixture.cs
示例9: ConvertedPythonCode
public void ConvertedPythonCode()
{
string expectedCode = "class Foo(object):\r\n" +
"\tdef Run(self):\r\n" +
"\t\treturn self.ToString()";
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string code = converter.Convert(csharp);
Assert.AreEqual(expectedCode, code);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:10,代码来源:BaseClassReferenceTestFixture.cs
示例10: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef GetCount(self):\r\n" +
"\t\treturn 10";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:10,代码来源:LocalVariableNotInitializedTestFixture.cs
示例11: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef __init__(self):\r\n" +
"\t\tSystem.Console.WriteLine(\"Test\")";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:10,代码来源:StaticClassReferenceTestFixture.cs
示例12: ConvertedPythonCodeUsingFourSpacesAsIndent
public void ConvertedPythonCodeUsingFourSpacesAsIndent()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
converter.IndentString = new String(' ', 4);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
" pass";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:10,代码来源:EmptyCSharpClassConversionTestFixture.cs
示例13: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef TestMe(self, test):\r\n" +
"\t\ta = \"Ape\" if test else \"Monkey\"\r\n" +
"\t\treturn a";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:11,代码来源:TernaryOperatorConversionTestFixture.cs
示例14: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
" def IsEqual(self, o):\r\n" +
" return Object.ReferenceEquals(o, None)";
Assert.AreEqual(expectedPython, python, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:11,代码来源:ObjectReferenceEqualsConversionTestFixture.cs
示例15: GeneratedPythonSourceCode
public void GeneratedPythonSourceCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef Print(self):\r\n" +
"\t\ti = 0\r\n" +
"\t\tself.PrintInt(i)";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:11,代码来源:IntegerMethodParameterTestFixture.cs
示例16: Equals
public void Equals()
{
string code = GetCode(@"==");
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string pythonCode = converter.Convert(code);
string expectedPythonCode = "class Foo(object):\r\n" +
"\tdef Run(self, i):\r\n" +
"\t\tif i == 0:\r\n" +
"\t\t\treturn 10\r\n" +
"\t\treturn 0";
Assert.AreEqual(expectedPythonCode, pythonCode);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:BinaryOperatorConversionTests.cs
示例17: ConvertedPythonCode
public void ConvertedPythonCode()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
string expectedPython = "class Foo(object):\r\n" +
"\tdef CountDown(self):\r\n" +
"\t\ti = 10\r\n" +
"\t\twhile i > 0:\r\n" +
"\t\t\ti -= 1";
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:12,代码来源:WhileLoopConversionTestFixture.cs
示例18: ConvertCSharpClassWithFieldsWhereFirstFieldDoesNotHaveInitialValue
public void ConvertCSharpClassWithFieldsWhereFirstFieldDoesNotHaveInitialValue()
{
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
converter.IndentString = " ";
string python = converter.Convert(csharpClassWithTwoFieldsWhereFirstDoesNotHaveInitialValue);
string expectedPython =
"class Foo(object):\r\n" +
" def __init__(self):\r\n" +
" self._j = 1";
Assert.AreEqual(expectedPython, python);
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:12,代码来源:MultipleFieldsOnSameLineTests.cs
示例19: ConvertedPythonCode
public void ConvertedPythonCode()
{
string expectedPython = "class Foo(object):\r\n" +
"\tdef __init__(self):\r\n" +
"\t\tdoc = XmlDocument()\r\n" +
"\t\tdoc.LoadXml(\"<root/>\")";
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string python = converter.Convert(csharp);
Assert.AreEqual(expectedPython, python);
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:12,代码来源:ObjectCreationTestFixture.cs
示例20: Convert
public static bool Convert(SupportedLanguage inputLanguage, string ProvidedSource, out string ConvertedSource, out string ErrorMessage)
{
NRefactoryToPythonConverter converter = new
NRefactoryToPythonConverter(inputLanguage);
string convertedCode = converter.Convert(ProvidedSource);
ConvertedSource = convertedCode;
ErrorMessage = "";
return true;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:PythonHelpers.cs
注:本文中的ICSharpCode.PythonBinding.NRefactoryToPythonConverter类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论