public async Task AdminSentMessagesAsyncTest_WhenPartnerIdandFilter_ReturnsSentMessageReport() { var mockLogRepository = new Mock <ILogRepository>(); var mockContactRepository = new Mock <IContactRepository>(); var mockLogManager = new Mock <ILogManager>(); var mapper = new Mock <IMapper>(); var chatUser = EntityModellers.GetChatUserEntity(); var chatUserList = new List <ChatUser> { chatUser }; var partnerId = _rnd.Next(111, 1000); var filter = EntityModellers.GetSentMessageReportRequestModel(); var log = EntityModellers.GetSentLogsEntity(); var logs = new List <LogEntity> { log }; var sentReport = EntityModellers.GetSentMessageReportResponseModel(); var sentReports = new List <SentMessageReportResponseModel> { sentReport }; var expected = sentReports; mockContactRepository.Setup(x => x.GetChatUsersAsync(filter.SenderIds, partnerId)).ReturnsAsync(chatUserList); mockLogRepository.Setup(x => x.GetAllAsync()).ReturnsAsync(logs); mapper.Setup(x => x.Map <IEnumerable <LogEntity>, IEnumerable <SentMessageReportResponseModel> >(logs)).Returns(expected); var logManager = new LogManager(mockContactRepository.Object, mockLogRepository.Object, mapper.Object); var actual = await logManager.AdminSentMessagesAsync(partnerId, filter); Assert.Equal(expected, actual, new LogicEqualityComparer <SentMessageReportResponseModel>()); mockLogRepository.VerifyAll(); mockContactRepository.VerifyAll(); }