示例#1
0
        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);
        }
示例#2
0
        public App()
        {
            InitializeComponent();

            MainInstance = new Main();

            NotifyIcon = new NotifyIcon
            {
                Icon = SBlink.App.Properties.Resources.NotifyIcon,
                Visible = true
            };
            NotifyIcon.DoubleClick += OnNotifyIconDoubleClick;
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
 public void AccessingLightsWorks()
 {
     var main = new Main();
     Console.WriteLine(main.Facade.Lights);
 }