当前位置: 首页>>代码示例>>C#>>正文


C# NRefactoryToPythonConverter.Convert方法代码示例

本文整理汇总了C#中ICSharpCode.PythonBinding.NRefactoryToPythonConverter.Convert方法的典型用法代码示例。如果您正苦于以下问题:C# NRefactoryToPythonConverter.Convert方法的具体用法?C# NRefactoryToPythonConverter.Convert怎么用?C# NRefactoryToPythonConverter.Convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICSharpCode.PythonBinding.NRefactoryToPythonConverter的用法示例。


在下文中一共展示了NRefactoryToPythonConverter.Convert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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._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

示例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._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

示例5: 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

示例6: 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

示例7: 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

示例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()
		{
			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

示例10: 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

示例11: 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

示例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


注:本文中的ICSharpCode.PythonBinding.NRefactoryToPythonConverter.Convert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。