public async Task GetP2Ps_Should_Return_Call_IPodcastModelMapper_Map() { PodcastServiceMock mock = PodcastServiceMock.Create(); var p2Ps = new List <P2P> { new P2P { Id = 1, Title = "Bilgem Çakır" }, new P2P { Id = 2, Title = "Ebru Meriç Akgül" } }; mock.PodcastRepository .Setup(repository => repository.GetP2Ps()) .ReturnsAsync(() => p2Ps); mock.PodcastModelMapper .Setup(mapper => mapper.Map(It.Is <IEnumerable <P2P> >(p => p.Equals(p2Ps)))) .ReturnsAsync(() => new List <P2PModel>()); IEnumerable <IPodcastModel> p2pModels = await mock.GetP2Ps(); mock.PodcastModelMapper.Verify(repository => repository.Map(It.IsAny <IEnumerable <P2P> >()), Times.Once); Assert.NotNull(p2pModels); }
public async Task GetP2Ps_Should_Return_Call_IPodcastRepository_GetP2Ps() { PodcastServiceMock mock = PodcastServiceMock.Create(); mock.PodcastRepository .Setup(repository => repository.GetP2Ps()) .ReturnsAsync(() => new List <P2P>()); mock.PodcastModelMapper.Setup(mapper => mapper.Map(It.IsAny <IEnumerable <P2P> >())) .ReturnsAsync(() => new List <P2PModel>()); IEnumerable <IPodcastModel> p2pModels = await mock.GetP2Ps(); mock.PodcastRepository.Verify(repository => repository.GetP2Ps(), Times.Once); Assert.NotNull(p2pModels); }