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


C# NRefactoryToRubyConverter.Convert方法代码示例

本文整理汇总了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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:35,代码来源:ObjectInitializerConversionTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:33,代码来源:XmlDocCommentConversionTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:31,代码来源:PropertyWithGetSetStatementsTestFixture.cs

示例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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:26,代码来源:PropertyReferenceConversionTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:8,代码来源:GenerateMainMethodCallTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:9,代码来源:AssignmentOperatorConversionTestFixture.cs

示例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);
		}		
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:EmptyCSharpClassConversionTestFixture.cs

示例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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:11,代码来源:BaseClassConversionTestFixture.cs

示例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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:UsingStatementConversionTestFixture.cs

示例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;
        }
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:RubyHelpers.cs

示例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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:12,代码来源:SingleClassMethodConversionTestFixture.cs

示例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);
		}	
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:13,代码来源:ThrowExceptionConversionTestFixture.cs

示例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);
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:13,代码来源:VBClassConversionTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:14,代码来源:ObjectReferenceEqualsConversionTestFixture.cs

示例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);
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:14,代码来源:TernaryOperatorConversionTestFixture.cs


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