~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodParameterConversionTestFixture.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.NRefactory;
 
6
using ICSharpCode.PythonBinding;
 
7
using NUnit.Framework;
 
8
 
 
9
namespace PythonBinding.Tests.Converter
 
10
{
 
11
        /// <summary>
 
12
        /// Tests that method parameters are converted into Python
 
13
        /// correctly.
 
14
        /// </summary>
 
15
        [TestFixture]
 
16
        public class MethodParameterConversionTestFixture
 
17
        {
 
18
                string csharp = "class Foo\r\n" +
 
19
                                                "{\r\n" +
 
20
                                                "\tpublic int Run(int i)\r\n" +
 
21
                                                "\t{\r\n" +
 
22
                                                "\t\treturn i;\r\n" +
 
23
                                                "\t}\r\n" +
 
24
                                                "}";
 
25
 
 
26
                [Test]
 
27
                public void ConvertedPythonCode()
 
28
                {
 
29
                        NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
 
30
                        string code = converter.Convert(csharp);
 
31
                        string expectedCode = "class Foo(object):\r\n" +
 
32
                                                                        "\tdef Run(self, i):\r\n" +
 
33
                                                                        "\t\treturn i";
 
34
                        
 
35
                        Assert.AreEqual(expectedCode, code);
 
36
                }
 
37
        }
 
38
}