From b24b48fdd4019cab8e9a9fae872b8dd9e96e16a5 Mon Sep 17 00:00:00 2001 From: Guilherme Branco Stracini Date: Sun, 15 Jan 2023 18:27:03 +0400 Subject: [PATCH] Delete ZipCodeTests.cs --- Tests/ViaCEP.Tests/ZipCodeTests.cs | 113 ----------------------------- 1 file changed, 113 deletions(-) delete mode 100644 Tests/ViaCEP.Tests/ZipCodeTests.cs diff --git a/Tests/ViaCEP.Tests/ZipCodeTests.cs b/Tests/ViaCEP.Tests/ZipCodeTests.cs deleted file mode 100644 index 2d96cd9..0000000 --- a/Tests/ViaCEP.Tests/ZipCodeTests.cs +++ /dev/null @@ -1,113 +0,0 @@ -namespace ViaCep.Tests -{ - using Moq; - using System.Linq; - using System.Threading; - using System.Threading.Tasks; - using Xunit; - - /// - /// The zip code tests class. - /// - public class ZipCodeTests - { - /// - /// Validates the search by zip code. - /// - [Fact] - public void ValidateSearchByZipCode() - { - var fixtureResults = ResultsFixture.GetSampleResults(); - var clientMock = new Mock(); - clientMock - .Setup(c => c.Search(It.IsAny())) - .Returns(fixtureResults.First(r => r.ZipCode.Equals("12345-678"))); - - var result = clientMock.Object.Search("12345678"); - Assert.NotNull(result); - Assert.Equal("Any", result.Unit); - Assert.Equal("Rua Direita", result.Street); - Assert.Equal(string.Empty, result.Complement); - Assert.Equal(1, result.GIACode); - Assert.Equal(1, result.IBGECode); - Assert.Equal("Centro", result.Neighborhood); - Assert.Equal("São Paulo", result.City); - Assert.Equal("SP", result.StateInitials); - } - - /// - /// Validates the search by zip code asynchronous. - /// - /// - [Fact] - public async Task ValidateSearchByZipCodeAsync() - { - var fixtureResults = ResultsFixture.GetSampleResults(); - var clientMock = new Mock(); - clientMock - .Setup(c => c.SearchAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(fixtureResults.First(r => r.ZipCode.Equals("12345-678"))); - - var result = await clientMock.Object.SearchAsync("12345678", CancellationToken.None); - Assert.NotNull(result); - Assert.Equal("Any", result.Unit); - Assert.Equal("Rua Direita", result.Street); - Assert.Equal(string.Empty, result.Complement); - Assert.Equal(1, result.GIACode); - Assert.Equal(1, result.IBGECode); - Assert.Equal("Centro", result.Neighborhood); - Assert.Equal("São Paulo", result.City); - Assert.Equal("SP", result.StateInitials); - } - - - /// - /// Validates if the search by zip code don't throw a exception if the address doesn't have a gia code - /// - /// - [Fact] - public void ValidateSearchByZipCodeWithoutGiaCode() - { - var fixtureResults = ResultsFixture.GetSampleResults(); - var clientMock = new Mock(); - clientMock - .Setup(c => c.Search(It.IsAny())) - .Returns(fixtureResults.First(r => !r.GIACode.HasValue)); - - var result = clientMock.Object.Search("12345678"); - Assert.NotNull(result); - Assert.Equal("", result.Unit); - Assert.Equal("Rua Direita", result.Street); - Assert.Equal(string.Empty, result.Complement); - Assert.Null(result.GIACode); - Assert.Equal(1, result.IBGECode); - Assert.Equal("Centro", result.Neighborhood); - Assert.Equal("São Paulo", result.City); - Assert.Equal("SP", result.StateInitials); - } - - /// - /// Validates the search by zip code without gia code asynchronous. - /// - [Fact] - public async Task ValidateSearchByZipCodeWithoutGiaCodeAsync() - { - var fixtureResults = ResultsFixture.GetSampleResults(); - var clientMock = new Mock(); - clientMock - .Setup(c => c.SearchAsync(It.IsAny(), It.IsAny())) - .ReturnsAsync(fixtureResults.First(r => !r.GIACode.HasValue)); - - var result = await clientMock.Object.SearchAsync("12345678", CancellationToken.None); - Assert.NotNull(result); - Assert.Equal("", result.Unit); - Assert.Equal("Rua Direita", result.Street); - Assert.Equal(string.Empty, result.Complement); - Assert.Null(result.GIACode); - Assert.Equal(1, result.IBGECode); - Assert.Equal("Centro", result.Neighborhood); - Assert.Equal("São Paulo", result.City); - Assert.Equal("SP", result.StateInitials); - } - } -} \ No newline at end of file