public async Task GetSimilarWordsAsync_ResponseTest(string input, int maxDistance, int maxAmount, string[] results) { // Arrange ISpellCheckerService service = CreateSpellCheckerService( out Mock <IDataSource> mockDataSource); // Act IEnumerable <string> actual = await service.GetSimilarWordsAsync(input, maxDistance, maxAmount); // Assert actual.Should() .Equal(results); }
public async Task GetSimilarWordsAsync_IDataSource_IsNull_ExpectException() { // Arrange ISpellCheckerService service = CreateSpellCheckerService( out Mock <IDataSource> mockDataSource); service._dataSource = null; // Act async Task Act() => await service.GetSimilarWordsAsync( It.IsAny <string>(), It.IsAny <double>(), It.IsAny <int>()); // Assert await Assert.ThrowsAsync <InvalidOperationException>(Act); }