~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Schema/AttributeGroupRefTestFixture.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using MonoDevelop.Ide.CodeCompletion;
 
3
using MonoDevelop.XmlEditor;
 
4
using NUnit.Framework;
 
5
using System;
 
6
using System.IO;
 
7
 
 
8
namespace MonoDevelop.XmlEditor.Tests.Schema
 
9
{
 
10
        /// <summary>
 
11
        /// Element that uses an attribute group ref.
 
12
        /// </summary>
 
13
        [TestFixture]
 
14
        public class AttributeGroupRefTestFixture : SchemaTestFixtureBase
 
15
        {
 
16
                ICompletionData[] attributeCompletionData;
 
17
                
 
18
                public override void FixtureInit()
 
19
                {                       
 
20
                        XmlElementPath path = new XmlElementPath();
 
21
                        path.Elements.Add(new QualifiedName("note", "http://www.w3schools.com"));
 
22
                        attributeCompletionData = SchemaCompletionData.GetAttributeCompletionData(path);
 
23
                }
 
24
                
 
25
                [Test]
 
26
                public void AttributeCount()
 
27
                {
 
28
                        Assert.AreEqual(4, attributeCompletionData.Length, "Should be 4 attributes.");
 
29
                }
 
30
                
 
31
                [Test]
 
32
                public void NameAttribute()
 
33
                {
 
34
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "name"), 
 
35
                                      "Attribute name does not exist.");
 
36
                }               
 
37
                
 
38
                [Test]
 
39
                public void IdAttribute()
 
40
                {
 
41
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "id"), 
 
42
                                      "Attribute id does not exist.");
 
43
                }               
 
44
                
 
45
                [Test]
 
46
                public void StyleAttribute()
 
47
                {
 
48
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "style"), 
 
49
                                      "Attribute style does not exist.");
 
50
                }       
 
51
                
 
52
                [Test]
 
53
                public void TitleAttribute()
 
54
                {
 
55
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeCompletionData, "title"), 
 
56
                                      "Attribute title does not exist.");
 
57
                }               
 
58
                
 
59
                protected override string GetSchema()
 
60
                {
 
61
                        return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"http://www.w3schools.com\" xmlns=\"http://www.w3schools.com\" elementFormDefault=\"qualified\">\r\n" +
 
62
                                "<xs:attributeGroup name=\"coreattrs\">" +
 
63
                                "\t<xs:attribute name=\"id\" type=\"xs:string\"/>" +
 
64
                                "\t<xs:attribute name=\"style\" type=\"xs:string\"/>" +
 
65
                                "\t<xs:attribute name=\"title\" type=\"xs:string\"/>" +
 
66
                                "</xs:attributeGroup>" +
 
67
                                "\t<xs:element name=\"note\">\r\n" +
 
68
                                "\t\t<xs:complexType>\r\n" +
 
69
                                "\t\t\t<xs:attributeGroup ref=\"coreattrs\"/>" +
 
70
                                "\t\t\t<xs:attribute name=\"name\" type=\"xs:string\"/>\r\n" +
 
71
                                "\t\t</xs:complexType>\r\n" +
 
72
                                "\t</xs:element>\r\n" +
 
73
                                "</xs:schema>";
 
74
                }
 
75
        }
 
76
}