~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.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.FormsDesigner;
 
6
using ICSharpCode.PythonBinding;
 
7
using ICSharpCode.Scripting.Tests.Utils;
 
8
using ICSharpCode.SharpDevelop.Dom;
 
9
using NUnit.Framework;
 
10
using PythonBinding.Tests.Utils;
 
11
 
 
12
namespace PythonBinding.Tests.Designer
 
13
{
 
14
        /// <summary>
 
15
        /// Base class that tests the PythonDesignerGenerator.InsertEventComponent method.
 
16
        /// </summary>
 
17
        public class InsertEventHandlerTestFixtureBase
 
18
        {
 
19
                protected string file;
 
20
                protected int position;
 
21
                protected bool insertedEventHandler;
 
22
                protected MockTextEditorViewContent mockViewContent;
 
23
                protected DerivedFormDesignerViewContent viewContent;
 
24
                protected string fileName = @"C:\Projects\Python\mainform.py";
 
25
                protected DerivedPythonDesignerGenerator generator;
 
26
                protected MockTextEditorOptions textEditorOptions;
 
27
 
 
28
                [TestFixtureSetUp]
 
29
                public void SetUpFixture()
 
30
                {
 
31
                        textEditorOptions = new MockTextEditorOptions();
 
32
                        generator = new DerivedPythonDesignerGenerator(textEditorOptions);
 
33
                        mockViewContent = new MockTextEditorViewContent();
 
34
                        viewContent = new DerivedFormDesignerViewContent(mockViewContent, new MockOpenedFile(fileName));
 
35
                        generator.Attach(viewContent);
 
36
                        viewContent.DesignerCodeFileContent = GetTextEditorCode();
 
37
                        
 
38
                        PythonParser parser = new PythonParser();
 
39
                        ICompilationUnit parserCompilationUnit = parser.Parse(new DefaultProjectContent(), fileName, GetTextEditorCode());
 
40
                        ParseInformation parseInfo = new ParseInformation(parserCompilationUnit);
 
41
                        generator.ParseInfoToReturnFromParseFileMethod = parseInfo;
 
42
                        
 
43
                        AfterSetUpFixture();
 
44
                }
 
45
                
 
46
                /// <summary>
 
47
                /// Called at the end of the SetUpFixture method.
 
48
                /// </summary>
 
49
                public virtual void AfterSetUpFixture()
 
50
                {
 
51
                }
 
52
                
 
53
                /// <summary>
 
54
                /// Gets the form's code.
 
55
                /// </summary>
 
56
                protected virtual string GetTextEditorCode()
 
57
                {
 
58
                        return String.Empty;
 
59
                }
 
60
        }
 
61
}