~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/WixBinding/Test/Gui/WixProjectWithLibraryItemsTestFixture.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 ICSharpCode.SharpDevelop.Internal.Templates;
 
5
using ICSharpCode.SharpDevelop.Project;
 
6
using ICSharpCode.WixBinding;
 
7
using NUnit.Framework;
 
8
using System;
 
9
using System.Windows.Forms;
 
10
using WixBinding.Tests.Utils;
 
11
 
 
12
namespace WixBinding.Tests.Gui
 
13
{
 
14
        /// <summary>
 
15
        /// Tests that an expanded WixLibraryFolderNode contains WixLibraryNodes.
 
16
        /// </summary>
 
17
        [TestFixture]
 
18
        public class WixProjectWithLibraryItemsTestFixture
 
19
        {
 
20
                WixProject wixProject;
 
21
                WixLibraryFolderNode wixLibraryFolderNode;
 
22
                WixLibraryProjectItem firstWixLibraryItem;
 
23
                WixLibraryProjectItem secondWixLibraryItem;
 
24
                WixLibraryNode firstWixLibraryNode;
 
25
                WixLibraryNode secondWixLibraryNode;
 
26
                
 
27
                [TestFixtureSetUp]
 
28
                public void SetUpFixture()
 
29
                {
 
30
                        wixProject = WixBindingTestsHelper.CreateEmptyWixProject();
 
31
                        
 
32
                        // Add wix library item.
 
33
                        firstWixLibraryItem = new WixLibraryProjectItem(wixProject);
 
34
                        firstWixLibraryItem.Include = @"..\..\first.wixlib";
 
35
                        ProjectService.AddProjectItem(wixProject, firstWixLibraryItem);
 
36
                        
 
37
                        // Add another wix library item.
 
38
                        secondWixLibraryItem = new WixLibraryProjectItem(wixProject);
 
39
                        secondWixLibraryItem.Include = @"..\..\second.wixlib";
 
40
                        ProjectService.AddProjectItem(wixProject, secondWixLibraryItem);
 
41
 
 
42
                        // Run Initialize on the WixLibraryFolderNode, which is 
 
43
                        // equivalent to expanding the node, so it adds it children. Cannot
 
44
                        // call ExtTreeNode.Expanding since this relies on the tree node
 
45
                        // being visible.
 
46
                        WixLibraryFolderNodeTester nodeTester = new WixLibraryFolderNodeTester(wixProject);
 
47
                        nodeTester.RunInitialize();
 
48
                        
 
49
                        wixLibraryFolderNode = (WixLibraryFolderNode)nodeTester;
 
50
                        firstWixLibraryNode = (WixLibraryNode)wixLibraryFolderNode.Nodes[0];
 
51
                        secondWixLibraryNode = (WixLibraryNode)wixLibraryFolderNode.Nodes[1];
 
52
                }
 
53
                
 
54
                [Test]
 
55
                public void WixLibraryHasTwoChildren()
 
56
                {
 
57
                        Assert.AreEqual(2, wixLibraryFolderNode.Nodes.Count);
 
58
                }
 
59
                
 
60
                [Test]
 
61
                public void FirstWixLibraryNodeText()
 
62
                {
 
63
                        Assert.AreEqual("first.wixlib", firstWixLibraryNode.Text);
 
64
                }
 
65
                
 
66
                [Test]
 
67
                public void FirstWixLibraryContextMenuPath()
 
68
                {
 
69
                        Assert.AreEqual("/SharpDevelop/Pads/ProjectBrowser/ContextMenu/WixLibraryNode", firstWixLibraryNode.ContextmenuAddinTreePath);
 
70
                }
 
71
        
 
72
                [Test]
 
73
                public void SecondWixLibraryNodeText()
 
74
                {
 
75
                        Assert.AreEqual("second.wixlib", secondWixLibraryNode.Text);
 
76
                }
 
77
                
 
78
                [Test]
 
79
                public void NewWixLibraryProjectItem()
 
80
                {
 
81
                        IProject p = WixBindingTestsHelper.CreateEmptyWixProject();
 
82
                        WixLibraryProjectItem item = new WixLibraryProjectItem(p);
 
83
                        Assert.AreEqual(WixItemType.Library, item.ItemType);
 
84
                }
 
85
        }
 
86
}