~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializerConstructorStringArrayTestFixture.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 System.Collections.Generic;
 
6
using System.ComponentModel;
 
7
using System.ComponentModel.Design;
 
8
using System.Drawing;
 
9
using System.Windows.Forms;
 
10
 
 
11
using ICSharpCode.PythonBinding;
 
12
using ICSharpCode.Scripting.Tests.Utils;
 
13
using IronPython.Compiler.Ast;
 
14
using NUnit.Framework;
 
15
using PythonBinding.Tests.Utils;
 
16
 
 
17
namespace PythonBinding.Tests.Designer
 
18
{
 
19
        /// <summary>
 
20
        /// Tests that the constructor arguments are returned when the first argument is
 
21
        /// an array.
 
22
        /// </summary>
 
23
        [TestFixture]
 
24
        public class DeserializeConstructorStringArrayTestFixture
 
25
        {               
 
26
                string code =  "System.Windows.Forms.ListViewItem(System.Array[System.String](\r\n" +
 
27
                                "    [\"a\",\r\n" +
 
28
                                "    \"sa\",\r\n" +
 
29
                                "    \"sa2\"]))\r\n";
 
30
 
 
31
                List<object> args;
 
32
                
 
33
                [TestFixtureSetUp]
 
34
                public void SetUpFixture()
 
35
                {
 
36
                        MockComponentCreator componentCreator = new MockComponentCreator();
 
37
                        CallExpression callExpression = PythonParserHelper.GetCallExpression(code);                     
 
38
                        PythonCodeDeserializer deserializer = new PythonCodeDeserializer(componentCreator);
 
39
                        args = deserializer.GetArguments(callExpression);
 
40
                }
 
41
                
 
42
                [Test]
 
43
                public void OneArgument()
 
44
                {
 
45
                        Assert.AreEqual(1, args.Count);
 
46
                }
 
47
 
 
48
                [Test]
 
49
                public void ArgumentIsStringArray()
 
50
                {
 
51
                        string[] array = new string[0];
 
52
                        Assert.IsInstanceOf(array.GetType(), args[0]);
 
53
                }
 
54
        }
 
55
}