public void MustSubscribeToClickEvent()
        {
            var button = new NotificationButtonMock();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            sut.RegisterNotification(button);

            Assert.IsTrue(button.HasSubscribed);
        }
        public void MustCloseWindowWhenTerminating()
        {
            var button = new NotificationButtonMock();
            var window = new Mock <IWindow>();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object);
            sut.RegisterNotification(button);
            button.Click();
            sut.Terminate();

            window.Verify(w => w.Close());
        }
        public void MustOpenOnlyOneWindow()
        {
            var button = new NotificationButtonMock();
            var window = new Mock <IWindow>();
            var sut    = new LogNotificationController(logger.Object, uiFactory.Object);

            uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object);
            sut.RegisterNotification(button);
            button.Click();
            button.Click();
            button.Click();
            button.Click();
            button.Click();

            uiFactory.Verify(u => u.CreateLogWindow(It.IsAny <ILogger>()), Times.Once);
            window.Verify(u => u.Show(), Times.Once);
            window.Verify(u => u.BringToForeground(), Times.Exactly(4));
        }