Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Upload dotnet package
name: Upload dotnet package

on:
push:
Expand All @@ -12,24 +12,34 @@ jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
source-url: https://nuget.pkg.github.com/danilolutz/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- run: dotnet build --configuration Release CoreZipCode.sln

- name: Create the package
run: dotnet pack --configuration Release CoreZipCode.sln --include-symbols -p:PackageVersion=${{github.ref_name}} -v normal

- name: Upload a Build Artifact
uses: softprops/action-gh-release@v1
with:
files: CoreZipCode/bin/Release/CoreZipCode.${{github.ref_name}}.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish the package to GPR
run: dotnet nuget push CoreZipCode/bin/Release/CoreZipCode.${{github.ref_name}}.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json

- name: NuGet login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}

- name: NuGet push
run: dotnet nuget push CoreZipCode/bin/Release/CoreZipCode.${{github.ref_name}}.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
14 changes: 7 additions & 7 deletions CoreZipCode.Tests/CoreZipCode.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.2">
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageReference Include="Moq" Version="4.18.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

Expand Down
26 changes: 13 additions & 13 deletions CoreZipCode.Tests/Services/ZipCode/SmartyApi/SmartyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,25 @@ public async Task MustGetZipCodeByParamsListAsync()
}

[Fact]
public void MustThrowTheExceptionsAsync()
public async Task MustThrowTheExceptionsAsync()
{
var exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 12345678901234567890 "));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Result.Message);
var exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 12345678901234567890 "));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Message);

exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 12A"));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 12A"));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Message);

exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 123A5678 "));
Assert.Equal(InvalidZipCodeFormatMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync(" 123A5678 "));
Assert.Equal(InvalidZipCodeFormatMessage, exception.Message);

exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("Lorem ipsum dolor sit amet amet sit", "Mountain View", "1600 Amphitheatre Pkwy"));
Assert.Equal(InvalidStateMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("Lorem ipsum dolor sit amet amet sit", "Mountain View", "1600 Amphitheatre Pkwy"));
Assert.Equal(InvalidStateMessage, exception.Message);

exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("CA", "Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere posuere.", "1600 Amphitheatre Pkwy"));
Assert.Equal(InvalidCityMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("CA", "Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere posuere.", "1600 Amphitheatre Pkwy"));
Assert.Equal(InvalidCityMessage, exception.Message);

exception = Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("CA", "Mountain View", "Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere posuere."));
Assert.Equal(InvalidStreetMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<SmartyException>(() => _service.ExecuteAsync("CA", "Mountain View", "Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere posuere."));
Assert.Equal(InvalidStreetMessage, exception.Message);
}
}
}
34 changes: 17 additions & 17 deletions CoreZipCode.Tests/Services/ZipCode/ViaCepApi/ViaCepTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,31 +174,31 @@ public async Task MustGetZipCodeObjectListAsync()
}

[Fact]
public void MustThrowTheExceptionsAsync()
public async Task MustThrowTheExceptionsAsync()
{
var exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync(" 12345-67 "));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Result.Message);
var exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync(" 12345-67 "));
Assert.Equal(InvalidZipCodeSizeMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync(" 123A5-678 "));
Assert.Equal(InvalidZipCodeFormatMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync(" 123A5-678 "));
Assert.Equal(InvalidZipCodeFormatMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("U", "Araraquara", "barão do rio"));
Assert.Equal(InvalidStateMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("U", "Araraquara", "barão do rio"));
Assert.Equal(InvalidStateMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ar", "barão do rio"));
Assert.Equal(InvalidCityMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ar", "barão do rio"));
Assert.Equal(InvalidCityMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ara", "ba"));
Assert.Equal(InvalidStreetMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ara", "ba"));
Assert.Equal(InvalidStreetMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("", "Araraquara", "barão do rio"));
Assert.Equal(InvalidStateMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("", "Araraquara", "barão do rio"));
Assert.Equal(InvalidStateMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "", "barão do rio"));
Assert.Equal(InvalidCityMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "", "barão do rio"));
Assert.Equal(InvalidCityMessage, exception.Message);

exception = Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ara", ""));
Assert.Equal(InvalidStreetMessage, exception.Result.Message);
exception = await Assert.ThrowsAsync<ViaCepException>(() => _service.ExecuteAsync("SP", "Ara", ""));
Assert.Equal(InvalidStreetMessage, exception.Message);
}
}
}
4 changes: 2 additions & 2 deletions CoreZipCode/CoreZipCode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PackageId>CoreZipCode</PackageId>
<Title>CoreZipCode</Title>
<Version>2.0.8</Version>
<Version>2.0.9</Version>
<Authors>Danilo Lutz</Authors>
<Company>Danilo Lutz</Company>
<license>https://github.com/danilolutz/CoreZipCode/blob/master/LICENSE</license>
Expand Down Expand Up @@ -37,7 +37,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion SampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static bool PrintMenu()
Console.WriteLine(" |**** CoreZipCode Demo Application ****|");
Console.WriteLine(" ---------------------------------------");
Console.WriteLine(" 1 - ViaCep Service");
Console.WriteLine(" 2 - SmartyStreets Service");
Console.WriteLine(" 2 - Smarty Service");
Console.WriteLine(" 3 - PostalpincodeIn Service");
Console.WriteLine(" 4 - PostcodesIo Service");
Console.WriteLine(" 5 - Get out");
Expand Down
2 changes: 1 addition & 1 deletion SampleApp/SampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down