diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..1bc6f35 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,35 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + + env: + BUILD_CONFIG: 'Release' + SOLUTION: 'DotNet.Core.Runtime.Faker.sln' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install .NET 7 SDK + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.x.x + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build $SOLUTION -c $BUILD_CONFIG --no-restore + + - name: Run tests + run: dotnet test --logger trx -c $BUILD_CONFIG --no-restore --no-build diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..299e2ea --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,49 @@ +name: Publish + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + env: + BUILD_CONFIG: 'Release' + SOLUTION: 'DotNet.Core.Runtime.Faker.sln' + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.x.x + + - name: Install dependencies + run: dotnet restore + + - name: Build + run: dotnet build $SOLUTION -c $BUILD_CONFIG --no-restore + + - name: Tag name + id: tag-name + run: | + echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Create the package + run: dotnet pack -p:PackageVersion=$SOURCE_TAG -c $BUILD_CONFIG src/DotNet.Core.Runtime.Faker.Moq --no-build --no-restore + env: + SOURCE_TAG: ${{ steps.tag-name.outputs.SOURCE_TAG }} + + - name: Create the package + run: dotnet pack -p:PackageVersion=$SOURCE_TAG -c $BUILD_CONFIG src/DotNet.Core.Runtime.Faker.FakeItEasy --no-build --no-restore + env: + SOURCE_TAG: ${{ steps.tag-name.outputs.SOURCE_TAG }} + + - name: Publish the package to nuget.org + run: dotnet nuget push **/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} + diff --git a/Readme.md b/Readme.md index 79cb094..671e4a3 100644 Binary files a/Readme.md and b/Readme.md differ diff --git a/src/DotNet.Core.Runtime.Faker.FakeItEasy/DotNet.Core.Runtime.Faker.FakeItEasy.csproj b/src/DotNet.Core.Runtime.Faker.FakeItEasy/DotNet.Core.Runtime.Faker.FakeItEasy.csproj index 16546a6..d6c1222 100644 --- a/src/DotNet.Core.Runtime.Faker.FakeItEasy/DotNet.Core.Runtime.Faker.FakeItEasy.csproj +++ b/src/DotNet.Core.Runtime.Faker.FakeItEasy/DotNet.Core.Runtime.Faker.FakeItEasy.csproj @@ -2,8 +2,22 @@ net7.0 + Luna.DotNet.Core.Runtime.Faker.FakeItEasy + README.md + snupkg + true + William Espinosa de Rezende + Biblioteca para troca de dependências em tempo de execução dos testes com FakeItEasy + dotnet core; tests; fakeiteasy; + https://github.com/willsbctm/DotNet.Core.Runtime.Faker + main + MIT + + + + diff --git a/src/DotNet.Core.Runtime.Faker.Moq/DotNet.Core.Runtime.Faker.Moq.csproj b/src/DotNet.Core.Runtime.Faker.Moq/DotNet.Core.Runtime.Faker.Moq.csproj index 1fff3f2..1cf0870 100644 --- a/src/DotNet.Core.Runtime.Faker.Moq/DotNet.Core.Runtime.Faker.Moq.csproj +++ b/src/DotNet.Core.Runtime.Faker.Moq/DotNet.Core.Runtime.Faker.Moq.csproj @@ -1,9 +1,23 @@ - net7.0 + net7.0 + Luna.DotNet.Core.Runtime.Faker.Moq + README.md + snupkg + true + William Espinosa de Rezende + Biblioteca para troca de dependências em tempo de execução dos testes com Moq + dotnet core; tests; moq; + https://github.com/willsbctm/DotNet.Core.Runtime.Faker + main + MIT + + + + diff --git a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingCustomFakerTests.cs b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingCustomFakerTests.cs index 35ffcd8..4237224 100644 --- a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingCustomFakerTests.cs +++ b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingCustomFakerTests.cs @@ -1,4 +1,3 @@ -using DotNet.Core.Faker.Runtime.WebApi.Sample; using DotNet.Core.Runtime.Faker.WebApi.Sample; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; @@ -15,7 +14,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests public class RuntimeFakerUsingCustomFakerTests { protected static DateTime changedValue; - private WebApplicationFactory factory; + private WebApplicationFactory factory; private IServiceProvider serviceProvider; private HttpClient cliente; @@ -24,7 +23,7 @@ public void OneTimeSetUp() { changedValue = new Bogus.Faker().Date.Past(); - factory = new WebApplicationFactory().WithWebHostBuilder(builder => + factory = new WebApplicationFactory().WithWebHostBuilder(builder => builder.ConfigureTestServices(services => { services.AddServiceWithFaker(() => new Clock()); diff --git a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingFakeItEasyTests.cs b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingFakeItEasyTests.cs index 5b39947..168efa7 100644 --- a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingFakeItEasyTests.cs +++ b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingFakeItEasyTests.cs @@ -1,4 +1,3 @@ -using DotNet.Core.Faker.Runtime.WebApi.Sample; using DotNet.Core.Runtime.Faker.WebApi.Sample; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; @@ -17,7 +16,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests public class RuntimeFakerUsingFakeItEasyTests { private DateTime registeredValue; - private WebApplicationFactory factory; + private WebApplicationFactory factory; private IServiceProvider serviceProvider; private HttpClient cliente; @@ -26,7 +25,7 @@ public void OneTimeSetUp() { registeredValue = new Bogus.Faker().Date.Future(); - factory = new WebApplicationFactory().WithWebHostBuilder(builder => + factory = new WebApplicationFactory().WithWebHostBuilder(builder => builder.ConfigureTestServices(services => { services.AddServiceWithFaker(faker => A.CallTo(() => faker.Now()).Returns(registeredValue)); diff --git a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingMoqTests.cs b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingMoqTests.cs index dd2475c..d9f08df 100644 --- a/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingMoqTests.cs +++ b/test/DotNet.Core.Runtime.Faker.Integration.Tests/RuntimeFakerUsingMoqTests.cs @@ -1,4 +1,3 @@ -using DotNet.Core.Faker.Runtime.WebApi.Sample; using DotNet.Core.Runtime.Faker.WebApi.Sample; using FluentAssertions; using Microsoft.AspNetCore.Mvc.Testing; @@ -16,7 +15,7 @@ namespace DotNet.Core.Faker.Runtime.Integration.Tests public class RuntimeFakerUsingMoqTests { private DateTime registeredValue; - private static WebApplicationFactory factory; + private static WebApplicationFactory factory; private static IServiceProvider serviceProvider; private HttpClient cliente; @@ -25,7 +24,7 @@ public void OneTimeSetUp() { registeredValue = new Bogus.Faker().Date.Future(); - factory = new WebApplicationFactory().WithWebHostBuilder(builder => + factory = new WebApplicationFactory().WithWebHostBuilder(builder => builder.ConfigureTestServices(services => { services.AddServiceWithFaker(mock => mock.Setup(x => x.Now()).Returns(registeredValue)); diff --git a/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Program.cs b/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Program.cs index be74ace..228d166 100644 --- a/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Program.cs +++ b/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Program.cs @@ -18,3 +18,5 @@ app.MapControllers(); app.Run(); + +public partial class Program { } diff --git a/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Startup.cs b/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Startup.cs deleted file mode 100644 index 83c0b04..0000000 --- a/test/DotNet.Core.Runtime.Faker.WebApi.Sample/Startup.cs +++ /dev/null @@ -1,28 +0,0 @@ -using DotNet.Core.Runtime.Faker.WebApi.Sample; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; - -namespace DotNet.Core.Faker.Runtime.WebApi.Sample -{ - public class Startup - { - public void ConfigureServices(IServiceCollection services) - { - services.AddTransient(); - services.AddControllers(); - } - - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) - { - app.UseHttpsRedirection(); - - app.UseRouting(); - - app.UseEndpoints(endpoints => - { - endpoints.MapControllers(); - }); - } - } -}