#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

50 lines
1.2 KiB

// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using ICSharpCode.NRefactory;
using ICSharpCode.RubyBinding;
using NUnit.Framework;
namespace RubyBinding.Tests.Converter
{
/// <summary>
/// Tests the CSharpToRubyConverter correctly converts the class
/// constructor when a value is assigned to one of its fields.
/// </summary>
[TestFixture]
public class IntegerClassFieldInitializedInConstructorTestFixture
{
string csharp =
"class Foo\r\n" +
"{\r\n" +
" private int i;\r\n" +
" public Foo()\r\n" +
" {\r\n" +
" i = 0;\r\n" +
" }\r\n" +
"}";
[Test]
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" +
" @i = 0\r\n" +
" end\r\n" +
"end";
Assert.AreEqual(expectedRuby, Ruby);
}
}
}