#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.
 
 
 
 
 
 

43 lines
1.1 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 ICSharpCode.NRefactory;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Converter
{
/// <summary>
/// Tests that a throw statement is converted to a
/// raise keyword in Python when converting
/// from C#.
/// </summary>
[TestFixture]
public class ThrowExceptionConversionTestFixture
{
string csharp = "class Foo\r\n" +
"{\r\n" +
"\tpublic string Run()\r\n" +
"\t{" +
"\t\tthrow new XmlException();\r\n" +
"\t}\r\n" +
"}";
[Test]
public void ConvertedPythonCode()
{
string expectedCode = "class Foo(object):\r\n" +
"\tdef Run(self):\r\n" +
"\t\traise XmlException()";
NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
string code = converter.Convert(csharp);
Assert.AreEqual(expectedCode, code);
}
}
}