~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/XmlEditor/Test/Completion/FirstCompletionListItemSelectedTestFixture.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.Collections.Generic;
 
6
 
 
7
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
 
8
using ICSharpCode.XmlEditor;
 
9
using NUnit.Framework;
 
10
using XmlEditor.Tests.Utils;
 
11
 
 
12
namespace XmlEditor.Tests.Completion
 
13
{
 
14
        /// <summary>
 
15
        /// Tests that the first item in the completion list view is selected by
 
16
        /// default. When coding in C# the default is to not select the
 
17
        /// first item in the completion list. With XML there tends to not
 
18
        /// be very many items in the completion list so selecting the first
 
19
        /// one can often make editing quicker.
 
20
        /// </summary>
 
21
        [TestFixture]
 
22
        public class FirstCompletionListItemSelectedTestFixture
 
23
        {
 
24
                ICompletionItem selectedCompletionItem;
 
25
                XmlCompletionItemCollection completionItems;
 
26
                XmlSchemaCompletion defaultSchema;
 
27
                
 
28
                [TestFixtureSetUp]
 
29
                public void SetUpFixture()
 
30
                {
 
31
                        defaultSchema = new XmlSchemaCompletion(ResourceManager.ReadXhtmlStrictSchema());
 
32
                        completionItems = new XmlCompletionItemCollection(defaultSchema.GetRootElementCompletion());
 
33
                        selectedCompletionItem = completionItems.SuggestedItem;
 
34
                }
 
35
                
 
36
                /// <summary>
 
37
                /// Sanity check to make sure that we actually have some completion
 
38
                /// data items from the xml completion data provider.
 
39
                /// </summary>
 
40
                [Test]
 
41
                public void GeneratedCompletionItemsHasMoreThanOneItem()
 
42
                {
 
43
                        Assert.IsTrue(completionItems.Count > 1);
 
44
                }
 
45
                
 
46
                [Test]
 
47
                public void SelectedCompletionItemMatchesFirstItemInCompletionList()
 
48
                {
 
49
                        Assert.AreSame(completionItems[0], selectedCompletionItem);
 
50
                }
 
51
        }
 
52
}