public void MustOpenOnlyOneWindow() { var window = new Mock <IWindow>(); var sut = new LogNotification(logger.Object, text.Object, uiFactory.Object); uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object); sut.Activate(); sut.Activate(); sut.Activate(); sut.Activate(); sut.Activate(); 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)); }
public void MustCloseWindowWhenTerminating() { var window = new Mock <IWindow>(); var sut = new LogNotification(logger.Object, text.Object, uiFactory.Object); uiFactory.Setup(u => u.CreateLogWindow(It.IsAny <ILogger>())).Returns(window.Object); sut.Activate(); sut.Terminate(); window.Verify(w => w.Close()); }