public async Task GetSpecialBySlug_Should_Throw_ArgumentNullException_If_Slug_Is_Null() { PodcastServiceMock mock = PodcastServiceMock.Create(); string slug = null; await Assert.ThrowsAsync <ArgumentNullException>(() => mock.GetSpecialBySlug(slug)); mock.PodcastRepository.Verify(repository => repository.GetSpecialBySlug(It.IsAny <string>()), Times.Never); }
public async Task GetSpecialBySlug_Should_Return_Call_IPodcastRepository_GetSpecialBySlug() { PodcastServiceMock mock = PodcastServiceMock.Create(); var slug = "microsoft-ozel-yayini"; mock.PodcastRepository .Setup(repository => repository.GetSpecialBySlug(It.Is <string>(s => s == slug))) .ReturnsAsync(() => new Special()); mock.PodcastModelMapper .Setup(mapper => mapper.Map(It.IsAny <Special>())) .ReturnsAsync(() => new SpecialModel()); IPodcastModel specialModel = await mock.GetSpecialBySlug(slug); mock.PodcastRepository.Verify(repository => repository.GetSpecialBySlug(It.IsAny <string>()), Times.Once); Assert.NotNull(specialModel); }