~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ModulusOperatorConversionTestFixture.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
        [TestFixture]
 
12
        public class ModulusOperatorConversionTestFixture
 
13
        {               
 
14
                string csharp = "class Foo\r\n" +
 
15
                                                "{\r\n" +
 
16
                                                "\tpublic void Convert(int a)\r\n" +
 
17
                                                "\t{\r\n" +
 
18
                                                "\t\ta %= 5;\r\n" +
 
19
                                                "\t}\r\n" +
 
20
                                                "}";
 
21
                                
 
22
                [Test]
 
23
                public void ConvertedPythonCode()
 
24
                {
 
25
                        NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp);
 
26
                        string python = converter.Convert(csharp);
 
27
                        string expectedPython = "class Foo(object):\r\n" +
 
28
                                                                        "\tdef Convert(self, a):\r\n" +
 
29
                                                                        "\t\ta %= 5";
 
30
                        
 
31
                        Assert.AreEqual(expectedPython, python);
 
32
                }
 
33
        }
 
34
}