예제 #1
0
        public void CompositeUpdater_Called_Calls()
        {
            _sut.DoUpdate();

            _composedUpdater1.Received(1).DoUpdate();
            _composedUpdater2.Received(1).DoUpdate();
        }
예제 #2
0
        static void Main(string[] args)
        {
            FakeCoffeeAPI fakeApi       = new FakeCoffeeAPI();
            IUpdater      coffeeMachine = CreateCoffeeMachine(fakeApi);

            while (true)
            {
                Console.Write("F = Fill Boiler,\nM = Empty Boiler,\nB = Press Button,\nR = Remove Pot,\nP = Place Pot,\nE = Empty Pot,\nX = Exit\nChoose option: ");

                string line = Console.ReadLine();

                string first = line.ToUpper().Substring(0, 1);

                SetFakeApiState(fakeApi, first);
                coffeeMachine.DoUpdate();

                Console.WriteLine();
                Console.WriteLine(fakeApi.ShowStateValues());

                if (first == "X")
                {
                    Console.WriteLine("Goodbye");
                    Console.ReadLine();
                    return;
                }
            }
        }
예제 #3
0
        public void StateUpdater_ButtonPushed_Sends()
        {
            _sensors.GetBrewButtonStatus().Returns(BrewButtonStatus.PUSHED);

            _sut.DoUpdate();

            _eventReceiver.Received().HandleEvent(Events.ButtonPushed);
        }
예제 #4
0
        public void CompositeUpdater_Called_CallsInRightOrder()
        {
            _sut.DoUpdate();

            Received.InOrder(() =>
            {
                _composedUpdater1.DoUpdate();
                _composedUpdater2.DoUpdate();
            });
        }
        public void CoffeeUpdater_Brew_SetsIndictorOff()
        {
            _stateProvider.CurrentState.Returns(States.Brew);

            _sut.DoUpdate();

            _controls.Received().SetIndicatorState(IndicatorState.OFF);
        }