예제 #1
0
        private async Task <ActionResult <IEnumerable <Message> > > GetIncomingMessagesActualAsync()
        {
            var messages = GetMessageList();
            var mockElementsMessageRepository = new Mock <IElementsMessageRepository>();
            var elementsList = new List <ElementsMessage> {
                messages.ElementAt(0).ElementsMessage, messages.ElementAt(1).ElementsMessage
            };

            mockElementsMessageRepository.Setup(repository => repository.GetElementsMessagesAsync("922308055", Direction.INCOMING)).ReturnsAsync(elementsList);

            var mockDifiMessageRepository = new Mock <IDifiMessageRepository>();
            var difiList = new List <DifiMessage> {
                messages.ElementAt(0).DifiMessage, messages.ElementAt(1).DifiMessage
            };

            mockDifiMessageRepository.Setup(repository => repository.GetDifiMessagesAsync("922308055", Direction.INCOMING)).ReturnsAsync(difiList);

            var mockMessageMergeService = new Mock <IMessageMergeService>();

            mockMessageMergeService.Setup(service => service.MergeMessagesListsInAsync("922308055", difiList, elementsList)).ReturnsAsync(messages);

            var messageController = new MessagesController();
            var actual            = await messageController.GetIncomingMessagesAsync("922308055", mockMessageMergeService.Object, mockDifiMessageRepository.Object, mockElementsMessageRepository.Object);

            return(actual);
        }