public async Task GetSpecials_Should_Return_Call_IPodcastModelMapper_Map() { PodcastServiceMock mock = PodcastServiceMock.Create(); var specials = new List <Special> { new Special { Id = 1, Title = "Microsoft Ozel Yayını" }, new Special { Id = 2, Title = "Facebook Skandalı" } }; mock.PodcastRepository .Setup(repository => repository.GetSpecials()) .ReturnsAsync(() => specials); mock.PodcastModelMapper .Setup(mapper => mapper.Map(It.Is <IEnumerable <Special> >(p => p.Equals(specials)))) .ReturnsAsync(() => new List <SpecialModel>()); IEnumerable <IPodcastModel> specialModels = await mock.GetSpecials(); mock.PodcastModelMapper.Verify(repository => repository.Map(It.IsAny <IEnumerable <Special> >()), Times.Once); Assert.NotNull(specialModels); }
public async Task GetSpecials_Should_Return_Call_IPodcastRepository_GetSpecials() { PodcastServiceMock mock = PodcastServiceMock.Create(); mock.PodcastRepository .Setup(repository => repository.GetSpecials()) .ReturnsAsync(() => new List <Special>()); mock.PodcastModelMapper.Setup(mapper => mapper.Map(It.IsAny <IEnumerable <Special> >())) .ReturnsAsync(() => new List <SpecialModel>()); IEnumerable <IPodcastModel> specials = await mock.GetSpecials(); mock.PodcastRepository.Verify(repository => repository.GetSpecials(), Times.Once); Assert.NotNull(specials); }