Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco committed Dec 30, 2019
2 parents 5ed8618 + 1a93c54 commit 1ab3e41
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var address = result.Address;
var neighborhood = result.Neighborhood
//do what you need with 'result' instance of ViaCEPResult.
```
## Querying by addres (list result)
## Querying by address (list result)

```cs
var results = ViaCEPClient.Search("SP", "São Paulo", "Avenida Paulista"); //search for the Avenida Paulista in São Paulo / SP
Expand Down
17 changes: 15 additions & 2 deletions ViaCEP.Tests/ZipCodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ public void ValidateSearchByZipCode()
{
var result = ViaCEPClient.Search("03177010");
Assert.NotNull(result);
Assert.Equal("Rua Doutor João Batista de Lacerda", result.Street);
Assert.Equal("Rua Doutor João Batista de Lacerda", result.Street);
Assert.Equal("Quarta Parada", result.Neighborhood);
Assert.Equal("São Paulo", result.City);
Assert.Equal("São Paulo", result.City);
Assert.Equal("SP", result.StateInitials);
}


/// <summary>
/// Validates if the search by zip code don't throw a exception if the address doesn't have a gia code
/// </summary>
/// <returns></returns>
[Fact]
public void ValidateSearchByZipCodeWithoutGiaCode()
{
var result = ViaCEPClient.Search("22795641");
Assert.NotNull(result);
Assert.Null(result.GIACode);
}
}
}
2 changes: 1 addition & 1 deletion ViaCEP/VIaCEPResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ public sealed class ViaCEPResult
/// The gia code.
/// </value>
[JsonProperty("gia")]
public Int32 GIACode { get; set; }
public Int32? GIACode { get; set; }
}
}

0 comments on commit 1ab3e41

Please sign in to comment.