aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.LightIntegration/LightFixture.cs
blob: 21c10be972ed9a4a8a6350dbd03997e9a36abcd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.

namespace WixToolsetTest.LightIntegration
{
    using System.IO;
    using System.Linq;
    using WixToolset.Core;
    using WixToolset.Tools;
    using WixToolsetTest.LightIntegration.Utility;
    using Xunit;

    public class LightFixture
    {
        [Fact]
        public void CanBuildFromWixout()
        {
            var folder = TestData.Get(@"TestData\Wixout");

            using (var fs = new DisposableFileSystem())
            {
                var baseFolder = fs.GetFolder();
                var intermediateFolder = Path.Combine(baseFolder, "obj");

                var program = new Light();
                var result = program.Run(new WixToolsetServiceProvider(), null, new[]
                {
                    Path.Combine(folder, "test.wixout"),
                    "-loc", Path.Combine(folder, "Package.en-us.wxl"),
                    "-b", Path.Combine(folder, "data"),
                    "-intermediateFolder", intermediateFolder,
                    "-o", Path.Combine(baseFolder, @"bin\test.msi")
                });

                Assert.Equal(0, result);

                var binFolder = Path.Combine(baseFolder, @"bin\");
                var builtFiles = Directory.GetFiles(binFolder, "*", SearchOption.AllDirectories);

                Assert.Equal(new[]{
                    "MsiPackage\\test.txt",
                    "test.msi",
                    "test.wir",
                    "test.wixpdb",
                }, builtFiles.Select(f => f.Substring(binFolder.Length)).OrderBy(s => s).ToArray());
            }
        }
    }
}