//
//
//
//
// $Revision$
//
using System;
using ICSharpCode.NRefactory;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Converter
{
///
/// Tests that a throw statement is converted to a
/// raise keyword in Python when converting
/// from C#.
///
[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);
}
}
}