forked from MaterialDesignInXAML/MaterialDesignInXamlToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BundledThemeTests.cs
51 lines (45 loc) · 1.88 KB
/
BundledThemeTests.cs
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
49
50
51
using System;
using MaterialDesignColors;
using Xunit;
namespace MaterialDesignThemes.Wpf.Tests
{
public class BundledThemeTests
{
[StaTheory]
[InlineData(null, null, null)]
[InlineData(BaseTheme.Light, null, null)]
[InlineData(BaseTheme.Inherit, null, null)]
[InlineData(null, PrimaryColor.Blue, null)]
[InlineData(BaseTheme.Light, PrimaryColor.Blue, null)]
[InlineData(BaseTheme.Inherit, PrimaryColor.Blue, null)]
[InlineData(null, null, SecondaryColor.Blue)]
[InlineData(BaseTheme.Light, null, SecondaryColor.Blue)]
[InlineData(BaseTheme.Inherit, null, SecondaryColor.Blue)]
public void WhenValueIsMissingThemeIsNotSet(BaseTheme? baseTheme, PrimaryColor? primaryColor, SecondaryColor? secondaryColor)
{
//Arrange
var bundledTheme = new BundledTheme();
//Act
bundledTheme.BaseTheme = baseTheme;
bundledTheme.PrimaryColor = primaryColor;
bundledTheme.SecondaryColor = secondaryColor;
//Assert
Assert.Throws<InvalidOperationException>(() => bundledTheme.GetTheme());
}
[StaFact]
public void WhenAllValuesAreSetThemeIsSet()
{
//Arrange
var bundledTheme = new BundledTheme();
//Act
bundledTheme.BaseTheme = BaseTheme.Light;
bundledTheme.PrimaryColor = PrimaryColor.Purple;
bundledTheme.SecondaryColor = SecondaryColor.Lime;
//Assert
ITheme theme = bundledTheme.GetTheme();
Assert.Equal(SwatchHelper.Lookup[(MaterialDesignColor)PrimaryColor.Purple], theme.PrimaryMid.Color);
Assert.Equal(SwatchHelper.Lookup[(MaterialDesignColor)SecondaryColor.Lime], theme.SecondaryMid.Color);
Assert.Equal(Theme.Light.MaterialDesignBody, theme.Body);
}
}
}