Exemple #1
0
        public void ReturnRequestedQuote_GivenQuoteExists()
        {
            QuoteEntity foundQuote = GetTestQuote();

            SetUpTest(foundQuote);

            CommandReceivedEventArgs commandReceivedEventArgs = GetEventArgs(1);

            _quoteCommand.Process(_chatClientMock.Object, commandReceivedEventArgs);

            _chatClientMock.Verify(x => x.SendMessage(foundQuote.ToString()));
        }
        public void ReturnRequestedQuote_GivenQuoteExists()
        {
            QuoteEntity foundQuote = GetTestQuote();

            SetUpTest(foundQuote);

            CommandReceivedEventArgs commandReceivedEventArgs = GetEventArgs(1);

            _quoteCommand.Process(_fakeChatClient, commandReceivedEventArgs);

            Assert.Equal(foundQuote.ToString(), _fakeChatClient.SentMessage);
        }
        private void HandleQuoteRequest(IChatClient triggeringClient, int requestQuoteId)
        {
            QuoteEntity quote = _repository.Single(QuoteEntityPolicy.ByQuoteId(requestQuoteId));

            if (quote == null)
            {
                triggeringClient.SendMessage($"I'm sorry, but we don't have a quote {requestQuoteId}... Yet...");
            }
            else
            {
                triggeringClient.SendMessage(quote.ToString());
            }
        }