diff --git a/README.md b/README.md index 60d610c..f193f57 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ foreach(var result in results){ ## Changelog +* 2023-07-28: Add integration tests [#71](https://github.com/guibranco/ViaCEP/issues/71) by [@Riju-bak](https://github.com/Riju-bak) * 2023-03-03: Update dependencies, change branch name, update logo. [@guibranco](https://github.com/guibranco) * 2021-06-21: Update dependencies version. [@guibranco](https://github.com/guibranco) * 2020-10-23: Add support to .NET Standard 2.0 and .NET Framework v4.6.1 and above. [@guibranco](https://github.com/guibranco) diff --git a/Tests/ViaCep.IntegrationTests/AddressTests.cs b/Tests/ViaCep.IntegrationTests/AddressTests.cs index e690168..be9967b 100644 --- a/Tests/ViaCep.IntegrationTests/AddressTests.cs +++ b/Tests/ViaCep.IntegrationTests/AddressTests.cs @@ -15,7 +15,9 @@ public async Task Search_WithValidAddress_ReturnsExpectedResult() var validZipCodeTwo = "01002-000"; //Another valid zip code for the same city and state //Act - var results = (await Client.SearchAsync(validState, validCity, validAddress, default)).ToList(); + var results = ( + await Client.SearchAsync(validState, validCity, validAddress, default) + ).ToList(); //Assert Assert.NotNull(results); @@ -31,7 +33,12 @@ public async Task Search_WithNonexistentAddress_ReturnsEmptyResults() var nonExistentCity = "Non-existent City"; //Act - var results = await Client.SearchAsync("XX", nonExistentCity, nonExistentAddress, default); + var results = await Client.SearchAsync( + "XX", + nonExistentCity, + nonExistentAddress, + default + ); //Assert Assert.Empty(results); @@ -48,8 +55,15 @@ public async Task Search_WithCanceledToken_ThrowsTaskCanceledException() cancellationTokenSource.Cancel(); //Act and Assert - await Assert.ThrowsAsync(() => - Client.SearchAsync(validState, validCity, validAddress, cancellationTokenSource.Token)); + await Assert.ThrowsAsync( + () => + Client.SearchAsync( + validState, + validCity, + validAddress, + cancellationTokenSource.Token + ) + ); } } } diff --git a/Tests/ViaCep.IntegrationTests/ZipCodeTests.cs b/Tests/ViaCep.IntegrationTests/ZipCodeTests.cs index a0a37df..3d6d193 100644 --- a/Tests/ViaCep.IntegrationTests/ZipCodeTests.cs +++ b/Tests/ViaCep.IntegrationTests/ZipCodeTests.cs @@ -27,7 +27,9 @@ public async Task Search_WithInvalidZipCode_ThrowsHttpRequestException() var invalidZipCode = "invalid"; //Act and Assert - await Assert.ThrowsAsync(() => Client.SearchAsync(invalidZipCode, default)); + await Assert.ThrowsAsync( + () => Client.SearchAsync(invalidZipCode, default) + ); } [Fact] @@ -38,8 +40,9 @@ public async Task Search_WithCanceledToken_ThrowsTaskCanceledException() cancellationTokenSource.Cancel(); //Act and Assert - await Assert.ThrowsAsync(() => - Client.SearchAsync("01001-000", cancellationTokenSource.Token)); + await Assert.ThrowsAsync( + () => Client.SearchAsync("01001-000", cancellationTokenSource.Token) + ); } } }