aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/MaterialDesignInXamlToolkit-master/MaterialDesignThemes.Wpf.Tests/PaletteHelperFixture.cs
blob: ec6782053e606188ce2a38a98ffc535cb72c0947 (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
using Moq;
using NSubstitute;
using Rhino.Mocks;
using Xunit;
using MockRepository = Rhino.Mocks.MockRepository;

namespace MaterialDesignThemes.Wpf.Tests
{    
    /// <summary>
    /// Proves that PaletteHelper is mockable, thus allowing TDD for view models which may want to change 
    /// an application's palette.
    /// </summary>
    /// <remarks>
    /// This is not an exhaustive test of the class itself.
    /// </remarks>
    public class PaletteHelperFixture
    {
        [Fact]
        public void IsMockableWithRhino()
        {
            var paletteHelper = MockRepository.GenerateStub<PaletteHelper>();

            paletteHelper.SetLightDark(true);

            paletteHelper.AssertWasCalled(ph => ph.SetLightDark(true));
        }

        [Fact]
        public void IsMockableWithMoq()
        {
            var mock = new Mock<PaletteHelper>();            

            mock.Object.SetLightDark(true);

            mock.Verify(ph => ph.SetLightDark(true));
        }

        [Fact]
        public void IsMockableWithNSubstitute()
        {
            var mock = Substitute.For<PaletteHelper>();

            mock.SetLightDark(true);

            mock.Received(1).SetLightDark(true);
        }
    }
}