コード例 #1
0
        static void Main(string[] args)
        {
            var userInteraction = new UserInteraction();
            var calculatorApp   = new CalculatorApp(new DefaultExchangeService(), userInteraction);

            userInteraction.DisplayMessage(CalculatorApp.HELP_MESSAGE);
            userInteraction.DisplayMessage("Other Commands: HELP, EXIT");
            Command lastExecutedCommand = null;

            while (!(lastExecutedCommand is ExitCommand))
            {
                lastExecutedCommand = calculatorApp.ProcessCommand();
            }
        }
コード例 #2
0
        public void ShouldPassMessageToIoStream()
        {
            var mockIoStream = new Mock <IUserIoStream>();
            var sut          = new UserInteraction(mockIoStream.Object);

            sut.DisplayMessage("Message 1");
            mockIoStream.Verify(m => m.WriteLine("Message 1"), Times.Once());
        }