~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/XmlEditor/Test/Schema/SchemaTestFixtureBase.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.IO;
 
6
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
 
7
using ICSharpCode.XmlEditor;
 
8
using NUnit.Framework;
 
9
 
 
10
namespace XmlEditor.Tests.Schema
 
11
{
 
12
        public abstract class SchemaTestFixtureBase
 
13
        {               
 
14
                XmlSchemaCompletion schemaCompletion;
 
15
 
 
16
                /// <summary>
 
17
                /// Gets the <see cref="XmlSchemaCompletionData"/> object generated
 
18
                /// by this class.
 
19
                /// </summary>
 
20
                /// <remarks>This object will be null until the <see cref="FixtureInitBase"/>
 
21
                /// has been run.</remarks>
 
22
                public XmlSchemaCompletion SchemaCompletion {
 
23
                        get { return schemaCompletion; }
 
24
                }
 
25
                
 
26
                /// <summary>
 
27
                /// Creates the <see cref="XmlSchemaCompletionData"/> object from 
 
28
                /// the derived class's schema.
 
29
                /// </summary>
 
30
                /// <remarks>Calls <see cref="FixtureInit"/> at the end of the method.
 
31
                /// </remarks>
 
32
                [TestFixtureSetUp]
 
33
                public void FixtureInitBase()
 
34
                {
 
35
                        schemaCompletion = CreateSchemaCompletionObject();
 
36
                        FixtureInit();
 
37
                }
 
38
                
 
39
                /// <summary>
 
40
                /// Method overridden by derived class so it can execute its own
 
41
                /// fixture initialisation.
 
42
                /// </summary>
 
43
                public virtual void FixtureInit()
 
44
                {
 
45
                }
 
46
                
 
47
                /// <summary>
 
48
                /// Returns the schema that will be used in this test fixture.
 
49
                /// </summary>
 
50
                protected virtual string GetSchema()
 
51
                {
 
52
                        return String.Empty;
 
53
                }
 
54
                
 
55
                /// <summary>
 
56
                /// Creates an <see cref="XmlSchemaCompletionData"/> object that 
 
57
                /// will be used in the test fixture.
 
58
                /// </summary>
 
59
                protected virtual XmlSchemaCompletion CreateSchemaCompletionObject()
 
60
                {
 
61
                        StringReader reader = new StringReader(GetSchema());
 
62
                        return new XmlSchemaCompletion(reader);
 
63
                }
 
64
        }
 
65
}