public async Task ShouldCallTheApiIfSearchTermIsNotNull() { //Given var sut = new EventRepo(_mockApiProvider.Object); var searchTerms = "stereophonics"; //When await sut.GetEventDetails(searchTerms); //Then _mockApiProvider.Verify(m => m.GetViagogoApiClient(), Times.Once); }
public async Task ShouldNotCallTheApiIfNullIsPassed() { //Given var searchTerms = default(string); var sut = new EventRepo(_mockApiProvider.Object); //When await sut.GetEventDetails(searchTerms); //Then _mockApiProvider.Verify(m => m.GetViagogoApiClient(), Times.Never); }
public async Task ShouldReturnNullIfNoResultsFromApiCall() { //Given var searchTerms = $"no-results-{Guid.NewGuid()}"; var sut = new EventRepo(_mockApiProvider.Object); //When var results = await sut.GetEventDetails(searchTerms); //Then results.Should().BeNull(); }