~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeBuilderTests.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.PythonBinding;
 
6
using NUnit.Framework;
 
7
 
 
8
namespace PythonBinding.Tests.Designer
 
9
{
 
10
        [TestFixture]
 
11
        public class PythonCodeBuilderTests
 
12
        {
 
13
                PythonCodeBuilder codeBuilder;
 
14
                
 
15
                [SetUp]
 
16
                public void Init()
 
17
                {
 
18
                        codeBuilder = new PythonCodeBuilder();
 
19
                        codeBuilder.IndentString = "\t";
 
20
                }
 
21
                
 
22
                /// <summary>
 
23
                /// Check that the "self._components = System.ComponentModel.Container()" line is generated
 
24
                /// the once and before any other lines of code.
 
25
                /// </summary>
 
26
                [Test]
 
27
                public void AppendCreateComponentsContainerTwice()
 
28
                {
 
29
                        codeBuilder.IndentString = "  ";
 
30
                        codeBuilder.IncreaseIndent();
 
31
                        codeBuilder.AppendIndentedLine("self._listView = System.Windows.Forms.ListView()");
 
32
                        codeBuilder.InsertCreateComponentsContainer();
 
33
                        codeBuilder.InsertCreateComponentsContainer();
 
34
                        
 
35
                        string expectedCode = 
 
36
                                "  self._components = System.ComponentModel.Container()\r\n" +
 
37
                                "  self._listView = System.Windows.Forms.ListView()\r\n";
 
38
                        
 
39
                        Assert.AreEqual(expectedCode, codeBuilder.ToString());
 
40
                }
 
41
        }
 
42
}