Ejemplo n.º 1
0
        public void Perform_MustExecuteInCorrectOrder()
        {
            var order = 0;

            context.Settings = new AppSettings();
            context.Settings.Taskbar.EnableTaskbar = true;

            displayMonitor.Setup(d => d.PreventSleepMode()).Callback(() => Assert.AreEqual(++order, 1));
            displayMonitor.Setup(d => d.InitializePrimaryDisplay(It.IsAny <int>())).Callback(() => Assert.AreEqual(++order, 2));
            displayMonitor.Setup(d => d.StartMonitoringDisplayChanges()).Callback(() => Assert.AreEqual(++order, 3));

            sut.Perform();

            displayMonitor.Verify(d => d.PreventSleepMode(), Times.Once);
            displayMonitor.Verify(d => d.InitializePrimaryDisplay(It.IsAny <int>()), Times.Once);
            displayMonitor.Verify(d => d.StartMonitoringDisplayChanges(), Times.Once);
        }
Ejemplo n.º 2
0
        public void MustPerformCorrectly()
        {
            var order = 0;

            displayMonitorMock.Setup(d => d.PreventSleepMode()).Callback(() => Assert.AreEqual(++order, 1));
            displayMonitorMock.Setup(d => d.InitializePrimaryDisplay(It.IsAny <int>())).Callback(() => Assert.AreEqual(++order, 2));
            displayMonitorMock.Setup(d => d.StartMonitoringDisplayChanges()).Callback(() => Assert.AreEqual(++order, 3));

            sut.Perform();

            displayMonitorMock.Verify(d => d.PreventSleepMode(), Times.Once);
            displayMonitorMock.Verify(d => d.InitializePrimaryDisplay(It.IsAny <int>()), Times.Once);
            displayMonitorMock.Verify(d => d.StartMonitoringDisplayChanges(), Times.Once);
        }