~halega/+junk/sharpdevelop

« back to all changes in this revision

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