protected void GivenThatWeSubscribeToErrors(Main main) { var mockSubscriber = new Mock<ISimpleObserver<string>>(); mockSubscriber .Setup(s => s.OnNext(It.IsAny<string>())) .Callback(() => haveError = true); main.Errors.Subscribe(mockSubscriber.Object); }
public App() { InitializeComponent(); MainInstance = new Main(); NotifyIcon = new NotifyIcon { Icon = SBlink.App.Properties.Resources.NotifyIcon, Visible = true }; NotifyIcon.DoubleClick += OnNotifyIconDoubleClick; }
public void GetErrorWhenSetColorThrowsException() { var main = new Main(); GivenThatWeSubscribeToErrors(main); var mockBlink1 = new Mock<IBlink1>(); mockBlink1 .Setup(b => b.SetColor(It.IsAny<ushort>(), It.IsAny<ushort>(), It.IsAny<ushort>())) .Throws(new InvalidOperationException()); light = new Blink1Light(main, mockBlink1.Object); WhenSettingAColor(); ThenWeGetAnError(); }
public void GetErrorWhenSetColorReturnsFalse() { var main = new Main(); GivenThatWeSubscribeToErrors(main); var mockBlink1 = new Mock<IBlink1>(); mockBlink1 .Setup(b => b.SetColor(It.IsAny<ushort>(), It.IsAny<ushort>(), It.IsAny<ushort>())) .Returns(false); light = new Blink1Light(main, mockBlink1.Object); WhenSettingAColor(); ThenWeGetAnError(); }
public void AccessingLightsWorks() { var main = new Main(); Console.WriteLine(main.Facade.Lights); }