~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/WixBinding/Test/Diff/OneNewFileTestFixture.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 NUnit.Framework;
 
6
using System;
 
7
using System.Collections.Generic;
 
8
 
 
9
namespace WixBinding.Tests.Diff
 
10
{
 
11
        [TestFixture]
 
12
        public class OneNewFileTestFixture : IDirectoryReader
 
13
        {
 
14
                WixPackageFilesDiffResult[] diffResults;
 
15
                
 
16
                [TestFixtureSetUp]
 
17
                public void SetUpFixture()
 
18
                {
 
19
                        WixDocument doc = new WixDocument();
 
20
                        doc.FileName = @"C:\Projects\Setup\Setup.wxs";
 
21
                        doc.LoadXml(GetWixXml());
 
22
                        WixPackageFilesDiff diff = new WixPackageFilesDiff(this);
 
23
                        diffResults = diff.Compare(doc.GetRootDirectory());
 
24
                }
 
25
                
 
26
                [Test]
 
27
                public void OneDiffResultFound()
 
28
                {
 
29
                        Assert.AreEqual(1, diffResults.Length);
 
30
                }
 
31
                
 
32
                [Test]
 
33
                public void DiffResultFileName()
 
34
                {
 
35
                        Assert.AreEqual(@"C:\Projects\Setup\bin\newfile.txt", diffResults[0].FileName);
 
36
                }
 
37
                
 
38
                [Test]
 
39
                public void DiffResultType()
 
40
                {
 
41
                        Assert.AreEqual(WixPackageFilesDiffResultType.NewFile, diffResults[0].DiffType);
 
42
                }
 
43
 
 
44
                public string[] GetFiles(string path)
 
45
                {
 
46
                        return new string[] {@"license.rtf", @"newfile.txt"};
 
47
                }
 
48
                
 
49
                public string[] GetDirectories(string path)
 
50
                {
 
51
                        return new string[0];
 
52
                }
 
53
                
 
54
                public bool DirectoryExists(string path)
 
55
                {
 
56
                        return true;
 
57
                }
 
58
                
 
59
                string GetWixXml()
 
60
                {
 
61
                        return "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>\r\n" +
 
62
                                "\t<Product Name='Test' \r\n" +
 
63
                                "\t         Version='1.0' \r\n" +
 
64
                                "\t         Language='1013' \r\n" +
 
65
                                "\t         Manufacturer='#develop' \r\n" +
 
66
                                "\t         Id='????????-????-????-????-????????????'>\r\n" +
 
67
                                "\t\t<Package/>\r\n" +
 
68
                                "\t\t<Directory Id='TARGETDIR' SourceName='SourceDir'>\r\n" +
 
69
                                "\t\t\t<Directory Id='ProgramFilesFolder' Name='PFiles'>\r\n" +
 
70
                                "\t\t\t\t<Directory Id='INSTALLDIR' Name='YourApp' LongName='Your Application'>\r\n" +
 
71
                                "\t\t\t\t\t<Component Id='MyComponent' DiskId='1'>\r\n" +
 
72
                                "\t\t\t\t\t\t<File Id='LicenseFile' Name='license.rtf' Source='bin\\license.rtf' />\r\n" +
 
73
                                "\t\t\t\t\t</Component>\r\n" +
 
74
                                "\t\t\t\t</Directory>\r\n" +
 
75
                                "\t\t\t</Directory>\r\n" +
 
76
                                "\t\t</Directory>\r\n" +
 
77
                                "\t</Product>\r\n" +
 
78
                                "</Wix>";
 
79
                }
 
80
        }
 
81
}