~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/WixSchemaTests.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.WixBinding;
 
5
using ICSharpCode.XmlEditor;
 
6
using NUnit.Framework;
 
7
using System;
 
8
using System.Xml.Schema;
 
9
 
 
10
namespace WixBinding.Tests.PackageFiles
 
11
{
 
12
        [TestFixture]
 
13
        public class WixSchemaTests
 
14
        {
 
15
                WixSchemaCompletion schema;
 
16
                
 
17
                [TestFixtureSetUp]
 
18
                public void SetUpFixture()
 
19
                {
 
20
                        schema = new WixSchemaCompletion();
 
21
                }
 
22
                
 
23
                [Test]
 
24
                public void DirectoryChildElements()
 
25
                {
 
26
                        string[] childElements = schema.GetChildElements("Directory");
 
27
                        Assert.AreEqual(4, childElements.Length);
 
28
                        Assert.Contains("Component", childElements);
 
29
                        Assert.Contains("Directory", childElements);
 
30
                        Assert.Contains("Merge", childElements);
 
31
                        Assert.Contains("SymbolPath", childElements);
 
32
                }
 
33
                
 
34
                [Test]
 
35
                public void DirectoryElementAttributes()
 
36
                {
 
37
                        string[] attributes = schema.GetAttributeNames("Directory");
 
38
                        Assert.IsTrue(attributes.Length > 0);
 
39
                        Assert.Contains("Id", attributes);
 
40
                        Assert.Contains("FileSource", attributes);
 
41
                }
 
42
                
 
43
                [Test]
 
44
                public void SrcAttributeExcluded()
 
45
                {
 
46
                        string[] attributes = schema.GetAttributeNames("Directory");
 
47
                        Assert.IsTrue(attributes.Length > 0);
 
48
                        foreach (string attribute in attributes) {
 
49
                                Assert.IsFalse(attribute == "src");
 
50
                        }
 
51
                }
 
52
                
 
53
                [Test]
 
54
                public void UpgradeImageDeprecatedAttributes()
 
55
                {
 
56
                        string[] attributes = schema.GetDeprecatedAttributes("UpgradeImage");
 
57
                        Assert.Contains("src", attributes);
 
58
                        Assert.Contains("srcPatch", attributes);
 
59
                }
 
60
                
 
61
                [Test]
 
62
                public void ProductAutogenuuidAttributeType()
 
63
                {
 
64
                        QualifiedName attributeName = schema.GetAttributeType("Product", "Id");
 
65
                        Assert.AreEqual("AutogenGuid", attributeName.Name);
 
66
                }
 
67
                
 
68
                [Test]
 
69
                public void ComponentKeyPathAttributeValues()
 
70
                {
 
71
                        string[] values = schema.GetAttributeValues("Component", "KeyPath");
 
72
                        Assert.AreEqual(2, values.Length);
 
73
                        Assert.Contains("yes", values);
 
74
                        Assert.Contains("no", values);
 
75
                }
 
76
        }
 
77
}