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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.XmlEditor/Tests/Schema/EnumAttributeValueTestFixture.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
        /// Tests attribute refs
 
12
        /// </summary>
 
13
        [TestFixture]
 
14
        public class EnumAttributeValueTestFixture : SchemaTestFixtureBase
 
15
        {
 
16
                ICompletionData[] attributeValues;
 
17
                
 
18
                public override void FixtureInit()
 
19
                {
 
20
                        XmlElementPath path = new XmlElementPath();
 
21
                        path.Elements.Add(new QualifiedName("foo", "http://foo.com"));
 
22
                        attributeValues = SchemaCompletionData.GetAttributeValueCompletionData(path, "id");
 
23
                }
 
24
                
 
25
                [Test]
 
26
                public void IdAttributeHasValueOne()
 
27
                {
 
28
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "one"),
 
29
                                      "Missing attribute value 'one'");
 
30
                }
 
31
                
 
32
                [Test]
 
33
                public void IdAttributeHasValueTwo()
 
34
                {
 
35
                        Assert.IsTrue(SchemaTestFixtureBase.Contains(attributeValues, "two"),
 
36
                                      "Missing attribute value 'two'");
 
37
                }               
 
38
                
 
39
                [Test]
 
40
                public void IdAttributeValueCount()
 
41
                {
 
42
                        Assert.AreEqual(2, attributeValues.Length, "Expecting 2 attribute values.");
 
43
                }
 
44
                
 
45
                protected override string GetSchema()
 
46
                {
 
47
                        return "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://foo.com\" targetNamespace=\"http://foo.com\" elementFormDefault=\"qualified\">\r\n" +
 
48
                                "\t<xs:element name=\"foo\">\r\n" +
 
49
                                "\t\t<xs:complexType>\r\n" +
 
50
                                "\t\t\t<xs:attribute name=\"id\">\r\n" +
 
51
                                "\t\t\t\t<xs:simpleType>\r\n" +
 
52
                                "\t\t\t\t\t<xs:restriction base=\"xs:string\">\r\n" +
 
53
                                "\t\t\t\t\t\t<xs:enumeration value=\"one\"/>\r\n" +
 
54
                                "\t\t\t\t\t\t<xs:enumeration value=\"two\"/>\r\n" +
 
55
                                "\t\t\t\t\t</xs:restriction>\r\n" +
 
56
                                "\t\t\t\t</xs:simpleType>\r\n" +
 
57
                                "\t\t\t</xs:attribute>\r\n" +
 
58
                                "\t\t</xs:complexType>\r\n" +
 
59
                                "\t</xs:element>\r\n" +
 
60
                                "</xs:schema>";
 
61
                }
 
62
        }
 
63
}