public async Task GetWordsByCategoryOrEmptyAsync_ReturnsEmptyIfResponseStatusCodeIsNotSuccessful() { // Arrange var clientFactoryMock = GetHttpClientFactoryMock( HttpStatusCode.BadRequest, InvalidResponseText); var systemUnderTest = new WordsProvider(_gameOptionsMock, clientFactoryMock, _loggerMock); // Act var wordsByCategory = await systemUnderTest.GetWordsByCategoryOrEmptyAsync(Category); // Assert wordsByCategory.Should() .BeEmpty(); }
public async Task GetWordsByCategoryOrEmptyAsync_ReturnsEmptyIfResponseCannotBeParsed( string serverResponseContent) { // Arrange var clientFactoryMock = GetHttpClientFactoryMock( HttpStatusCode.OK, serverResponseContent); var systemUnderTest = new WordsProvider(_gameOptionsMock, clientFactoryMock, _loggerMock); // Act var wordsByCategory = await systemUnderTest.GetWordsByCategoryOrEmptyAsync(Category); // Assert wordsByCategory.Should() .BeEmpty(); }
public async Task GetWordsByCategoryOrEmptyAsync_CanReturnWordsByCategory() { // Arrange var clientFactoryMock = GetHttpClientFactoryMock( HttpStatusCode.OK, ServerResponses.WordAssociationsJsonResponse); var systemUnderTest = new WordsProvider(_gameOptionsMock, clientFactoryMock, _loggerMock); // Act var wordsByCategory = await systemUnderTest.GetWordsByCategoryOrEmptyAsync(Category); // Assert wordsByCategory.Should() .Contain("gardening"); wordsByCategory.Should() .Contain("collecting"); wordsByCategory.Should() .Contain("cooking"); }