diff --git a/ViaCEP.Tests/ZipCodeTests.cs b/ViaCEP.Tests/ZipCodeTests.cs
index 3da7b37..d4226de 100644
--- a/ViaCEP.Tests/ZipCodeTests.cs
+++ b/ViaCEP.Tests/ZipCodeTests.cs
@@ -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);
}
+
+
+ ///
+ /// 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 result = ViaCEPClient.Search("22795641");
+ Assert.NotNull(result);
+ Assert.Null(result.GIACode);
+ }
}
}
diff --git a/ViaCEP/VIaCEPResult.cs b/ViaCEP/VIaCEPResult.cs
index aaeddee..c630006 100644
--- a/ViaCEP/VIaCEPResult.cs
+++ b/ViaCEP/VIaCEPResult.cs
@@ -87,6 +87,6 @@ public sealed class ViaCEPResult
/// The gia code.
///
[JsonProperty("gia")]
- public Int32 GIACode { get; set; }
+ public Int32? GIACode { get; set; }
}
}