private async Task <ActionResult <IEnumerable <Message> > > GetOutgoingMessagesAsyncActualAsync() { 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.OUTGOING)).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.OUTGOING)).ReturnsAsync(difiList); var mockMessageMergeService = new Mock <IMessageMergeService>(); mockMessageMergeService.Setup(service => service.MergeMessagesListsOutAsync("922308055", elementsList, difiList)).ReturnsAsync(messages); var messageController = new MessagesController(); var actual = await messageController.GetOutgoingMessagesAsync("922308055", mockMessageMergeService.Object, mockElementsMessageRepository.Object, mockDifiMessageRepository.Object); return(actual); }