Skip to content

Commit

Permalink
Update NuGet dependencies for Application and Application.Test. Add m…
Browse files Browse the repository at this point in the history
…issing unit tests
  • Loading branch information
dimitrietataru committed Aug 26, 2024
1 parent 7768e8c commit 9f8aa95
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CatNip.Application" Version="2.0.1" />
<PackageReference Include="CatNip.Application" Version="2.1.2" />
<PackageReference Include="FluentValidation" Version="11.9.2" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CatNip.Application.Test" Version="2.0.1" />
<PackageReference Include="CatNip.Application.Test" Version="2.1.2" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@

namespace Ace.Geograpi.Application.Tests.Services.Abstractions;

public abstract class XUnitAceServiceTests<TService, TRepository, TModel, TModelRoot, TId, TFiltering>
: XUnitAceServiceTests<TService, TRepository, TModel, TId, TFiltering>
where TService : AceService<TRepository, TModel, TId, TFiltering>
where TRepository : class, IAceRepository<TModel, TId, TFiltering>
where TModel : IModel<TId>
where TModelRoot : IModel<TId>
where TId : IEquatable<TId>
where TFiltering : IFilteringRequest
{
[Fact]
public virtual async Task GivenGetFilteredTModelRootWhenDataExistsThenReturnsData()
{
await base.GivenGetFilteredTWhenDataExistsThenReturnsData<TModelRoot>();
}

[Fact]
public virtual async Task GivenGetAllTModelRootWhenDataExistsThenReturnsData()
{
await base.GivenGetAllTWhenDataExistsThenReturnsData<TModelRoot>();
}
}

public abstract class XUnitAceServiceTests<TService, TRepository, TModel, TId, TFiltering>
: BaseAceServiceTests<TService, TRepository, TModel, TId, TFiltering>
where TService : AceService<TRepository, TModel, TId, TFiltering>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@

namespace Ace.Geograpi.Application.Tests.Services.Abstractions;

public abstract class XUnitCrudServiceTests<TService, TRepository, TModel, TModelRoot, TId>
: XUnitCrudServiceTests<TService, TRepository, TModel, TId>
where TService : CrudService<TRepository, TModel, TId>
where TRepository : class, ICrudRepository<TModel, TId>
where TModel : IModel<TId>
where TModelRoot : IModel
where TId : IEquatable<TId>
{
[Fact]
public virtual async Task GivenGetAllTModelRootWhenDataExistsThenReturnsData()
{
await base.GivenGetAllTWhenDataExistsThenReturnsData<TModelRoot>();
}
}

public abstract class XUnitCrudServiceTests<TService, TRepository, TModel, TId>
: BaseCrudServiceTests<TService, TRepository, TModel, TId>
where TService : CrudService<TRepository, TModel, TId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
using Ace.Geograpi.Application.Services;
using Ace.Geograpi.Application.Tests.Services.Abstractions;
using Ace.Geograpi.Domain.Models;
using Ace.Geograpi.Domain.Models.Root;
using Ace.Geograpi.Domain.QueryFilters;
using Ace.Geograpi.Domain.Repositories;

namespace Ace.Geograpi.Application.Tests.Services;

public sealed class ContinentServiceTests
: XUnitAceServiceTests<ContinentService, IContinentRepository, ContinentModel, int, ContinentQueryFilter>
: XUnitAceServiceTests<
ContinentService,
IContinentRepository,
ContinentModel,
ContinentRootModel,
int,
ContinentQueryFilter>
{
private readonly ContinentService continentService;
private readonly Mock<IContinentRepository> continentRepositoryMock;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
using Ace.Geograpi.Application.Services;
using Ace.Geograpi.Application.Tests.Services.Abstractions;
using Ace.Geograpi.Domain.Models;
using Ace.Geograpi.Domain.Models.Root;
using Ace.Geograpi.Domain.QueryFilters;
using Ace.Geograpi.Domain.Repositories;

namespace Ace.Geograpi.Application.Tests.Services;

public sealed class CountryServiceTests
: XUnitAceServiceTests<CountryService, ICountryRepository, CountryModel, int, CountryQueryFilter>
: XUnitAceServiceTests<
CountryService,
ICountryRepository,
CountryModel,
CountryRootModel,
int,
CountryQueryFilter>
{
private readonly CountryService countryService;
private readonly Mock<ICountryRepository> countryRepositoryMock;
Expand Down

0 comments on commit 9f8aa95

Please sign in to comment.