aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.Data/WindowsInstallerTableDefinitionsFixture.cs
blob: 5621a756ca497013646be30fc5752abb1ca13fa9 (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
// 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.Data
{
    using WixToolset.Data.WindowsInstaller;
    using Xunit;

    public class WindowsInstallerTableDefinitionsFixture
    {
        [Fact]
        public void CanCreateWindowsInstallerRows()
        {
            foreach (var tableDefinition in WindowsInstallerTableDefinitions.All)
            {
                var table = new Table(tableDefinition);
                var rowFromTable = table.CreateRow(null);
                var rowFromTableDefinition = tableDefinition.CreateRow(null);
                var expectedRowTypeName = tableDefinition.Name.Replace("_", "") + "Row";
                var expectedRowType = rowFromTable.GetType();

                Assert.Equal(expectedRowType, rowFromTableDefinition.GetType());
                if (typeof(Row) != expectedRowType)
                {
                    Assert.Equal(expectedRowTypeName, expectedRowType.Name);
                }
            }
        }
    }
}