// // // // // $Revision$ // using System; using ICSharpCode.NRefactory; using ICSharpCode.PythonBinding; using NUnit.Framework; namespace PythonBinding.Tests.Converter { /// /// Tests that C# code that creates a new XmlDocument object /// is converted to Python correctly. /// [TestFixture] public class ObjectCreationTestFixture { string csharp = "class Foo\r\n" + "{\r\n" + "\tpublic Foo()\r\n" + "\t{\r\n" + "\t\tXmlDocument doc = new XmlDocument();\r\n" + "\t\tdoc.LoadXml(\"\");\r\n" + "\t}\r\n" + "}"; [Test] public void ConvertedPythonCode() { string expectedPython = "class Foo(object):\r\n" + "\tdef __init__(self):\r\n" + "\t\tdoc = XmlDocument()\r\n" + "\t\tdoc.LoadXml(\"\")"; NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); string python = converter.Convert(csharp); Assert.AreEqual(expectedPython, python); } } }