Skip to content

Commit bde2a7f

Browse files
committed
Updated tests
1 parent 0f6cdda commit bde2a7f

File tree

292 files changed

+1343
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+1343
-299
lines changed

Tests/AdvancedMapping.Repositories.Mapperly.Tests/AdvancedMapping.Repositories.Mapperly.Tests.application.config

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,15 @@
147147
<option value="sql-lite" description="SQLite" />
148148
</options>
149149
</setting>
150+
<setting id="6010e890-6e2d-4812-9969-ffbdb8f93d87" title="DBSet naming convention" module="Intent.EntityFrameworkCore" type="select">
151+
<hint>Controls the naming convention of the DBSets created on the DBContext.</hint>
152+
<value>pluralized</value>
153+
<isRequiredFunction>return true;</isRequiredFunction>
154+
<options>
155+
<option value="pluralized" description="Pluralized" />
156+
<option value="same-as-entity" description="Same as entity" />
157+
</options>
158+
</setting>
150159
<setting id="684582e0-125a-4ddd-a950-714e2af41f15" title="Decimal precision and scale" module="Intent.Metadata.RDBMS" type="text">
151160
<hint>Format : precision, scale e.g. 16,4</hint>
152161
<isRequired>false</isRequired>

Tests/AdvancedMapping.Repositories.Mapperly.Tests/modules.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<module moduleId="Intent.Application.Contracts" version="5.1.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
44
<module moduleId="Intent.Application.DependencyInjection" version="4.1.11-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
55
<module moduleId="Intent.Application.DependencyInjection.MediatR" version="3.6.0" supportedClientVersions="[4.0.3-pre.6, 5.0.0-a)" />
6-
<module moduleId="Intent.Application.DomainInteractions" version="1.1.7-pre.1" supportedClientVersions="[4.5.15-a,5.0.0)" />
6+
<module moduleId="Intent.Application.DomainInteractions" version="1.1.7-pre.2" supportedClientVersions="[4.5.15-a,5.0.0)" />
77
<module moduleId="Intent.Application.Dtos" version="4.4.6" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
88
<module moduleId="Intent.Application.Dtos.Mapperly" version="1.0.0" supportedClientVersions="[4.5.18-a,5.0.0)" />
99
<module moduleId="Intent.Application.Dtos.Pagination" version="4.1.2" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />
@@ -30,7 +30,7 @@
3030
<module moduleId="Intent.Common.UnitOfWork" version="1.0.2" supportedClientVersions="[4.4.0-a,5.0.0)" />
3131
<module moduleId="Intent.Entities" version="5.1.14" supportedClientVersions="[4.3.3, 5.0.0-a)" />
3232
<module moduleId="Intent.Entities.Repositories.Api" version="5.1.9" supportedClientVersions="[4.4.0-a, 5.0.0-a)" />
33-
<module moduleId="Intent.EntityFrameworkCore" version="5.0.32-pre.0" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
33+
<module moduleId="Intent.EntityFrameworkCore" version="5.0.32-pre.1" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
3434
<module moduleId="Intent.EntityFrameworkCore.Repositories" version="4.7.16" supportedClientVersions="[4.5.15-a,5.0.0)" />
3535
<module moduleId="Intent.Infrastructure.DependencyInjection" version="4.1.12-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
3636
<module moduleId="Intent.Metadata.RDBMS" version="3.7.8-pre.0" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.Cosmos.Tests/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<module moduleId="Intent.Application.DependencyInjection" version="4.1.11-pre.0" supportedClientVersions="[4.5.15-a, 5.0.0-a)" />
66
<module moduleId="Intent.Application.DependencyInjection.AutoMapper" version="4.0.3" supportedClientVersions="[4.1.0-pre.0, 5.0.0-a)" />
77
<module moduleId="Intent.Application.DependencyInjection.MediatR" version="3.6.0" supportedClientVersions="[4.0.3-pre.6, 5.0.0-a)" />
8-
<module moduleId="Intent.Application.DomainInteractions" version="1.1.7-pre.1" supportedClientVersions="[4.5.15-a,5.0.0)" />
8+
<module moduleId="Intent.Application.DomainInteractions" version="1.1.7-pre.2" supportedClientVersions="[4.5.15-a,5.0.0)" />
99
<module moduleId="Intent.Application.Dtos" version="4.4.6" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
1010
<module moduleId="Intent.Application.Dtos.AutoMapper" version="4.0.18" supportedClientVersions="[4.5.0-a, 5.0.0-a)" />
1111
<module moduleId="Intent.Application.Dtos.Pagination" version="4.1.2" supportedClientVersions="[4.3.0-a, 5.0.0-a)" />

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Common/Interfaces/IApplicationDbContext.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ namespace AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application.Common.Inter
1111
{
1212
public interface IApplicationDbContext
1313
{
14-
DbSet<Customer> Customers { get; }
15-
DbSet<Order> Orders { get; }
16-
DbSet<Product> Products { get; }
17-
DbSet<User> Users { get; }
14+
DbSet<Customer> Customer { get; }
15+
DbSet<Order> Order { get; }
16+
DbSet<Product> Product { get; }
17+
DbSet<User> User { get; }
1818
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
1919
}
2020
}

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Customers/CreateCustomer/CreateCustomerCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task<Guid> Handle(CreateCustomerCommand request, CancellationToken
3232
IsActive = request.IsActive
3333
};
3434

35-
_dbContext.Customers.Add(customer);
35+
_dbContext.Customer.Add(customer);
3636
await _dbContext.SaveChangesAsync(cancellationToken);
3737
return customer.Id;
3838
}

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Customers/DeleteCustomer/DeleteCustomerCommandHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ public DeleteCustomerCommandHandler(IApplicationDbContext dbContext)
2626
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
2727
public async Task Handle(DeleteCustomerCommand request, CancellationToken cancellationToken)
2828
{
29-
var customer = await _dbContext.Customers.SingleOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
29+
var customer = await _dbContext.Customer.SingleOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
3030
if (customer is null)
3131
{
3232
throw new NotFoundException($"Could not find Customer '{request.Id}'");
3333
}
3434

35-
_dbContext.Customers.Remove(customer);
35+
_dbContext.Customer.Remove(customer);
3636
}
3737
}
3838
}

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Customers/GetCustomerById/GetCustomerByIdQueryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public GetCustomerByIdQueryHandler(IMapper mapper, IApplicationDbContext dbConte
3131
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
3232
public async Task<CustomerDto> Handle(GetCustomerByIdQuery request, CancellationToken cancellationToken)
3333
{
34-
var customer = await _dbContext.Customers.Where(x => x.Id == request.Id).ProjectTo<CustomerDto>(_mapper.ConfigurationProvider).SingleOrDefaultAsync(cancellationToken);
34+
var customer = await _dbContext.Customer.Where(x => x.Id == request.Id).ProjectTo<CustomerDto>(_mapper.ConfigurationProvider).SingleOrDefaultAsync(cancellationToken);
3535
if (customer is null)
3636
{
3737
throw new NotFoundException($"Could not find Customer '{request.Id}'");

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Customers/GetCustomers/GetCustomersQueryHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public GetCustomersQueryHandler(IMapper mapper, IApplicationDbContext dbContext)
3030
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
3131
public async Task<List<CustomerDto>> Handle(GetCustomersQuery request, CancellationToken cancellationToken)
3232
{
33-
var customers = await _dbContext.Customers
33+
var customers = await _dbContext.Customer
3434
.ProjectTo<CustomerDto>(_mapper.ConfigurationProvider)
3535
.ToListAsync(cancellationToken);
3636
return customers;

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Customers/UpdateCustomer/UpdateCustomerCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public UpdateCustomerCommandHandler(IApplicationDbContext dbContext)
2626
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
2727
public async Task Handle(UpdateCustomerCommand request, CancellationToken cancellationToken)
2828
{
29-
var customer = await _dbContext.Customers.SingleOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
29+
var customer = await _dbContext.Customer.SingleOrDefaultAsync(x => x.Id == request.Id, cancellationToken);
3030
if (customer is null)
3131
{
3232
throw new NotFoundException($"Could not find Customer '{request.Id}'");

Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests/AdvancedMappingCrud.DbContext.ProjectTo.Tests.Application/Implementation/UsersService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public async Task<Guid> CreateUser(UserCreateDto dto, CancellationToken cancella
4242
Email = dto.Email
4343
};
4444

45-
_dbContext.Users.Add(user);
45+
_dbContext.User.Add(user);
4646
await _dbContext.SaveChangesAsync(cancellationToken);
4747
return user.Id;
4848
}
4949

5050
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
5151
public async Task<UserDto> FindUserById(Guid id, CancellationToken cancellationToken = default)
5252
{
53-
var user = await _dbContext.Users.Where(x => x.Id == id).ProjectTo<UserDto>(_mapper.ConfigurationProvider).SingleOrDefaultAsync(cancellationToken);
53+
var user = await _dbContext.User.Where(x => x.Id == id).ProjectTo<UserDto>(_mapper.ConfigurationProvider).SingleOrDefaultAsync(cancellationToken);
5454
if (user is null)
5555
{
5656
throw new NotFoundException($"Could not find User '{id}'");
@@ -61,7 +61,7 @@ public async Task<UserDto> FindUserById(Guid id, CancellationToken cancellationT
6161
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
6262
public async Task<List<UserDto>> FindUsers(CancellationToken cancellationToken = default)
6363
{
64-
var users = await _dbContext.Users
64+
var users = await _dbContext.User
6565
.ProjectTo<UserDto>(_mapper.ConfigurationProvider)
6666
.ToListAsync(cancellationToken);
6767
return users;
@@ -74,7 +74,7 @@ public async Task UpdateUser(
7474
List<NewDTO> addresses,
7575
CancellationToken cancellationToken = default)
7676
{
77-
var user = await _dbContext.Users.SingleOrDefaultAsync(x => x.Id == id, cancellationToken);
77+
var user = await _dbContext.User.SingleOrDefaultAsync(x => x.Id == id, cancellationToken);
7878
if (user is null)
7979
{
8080
throw new NotFoundException($"Could not find User '{id}'");
@@ -89,13 +89,13 @@ public async Task UpdateUser(
8989
[IntentManaged(Mode.Fully, Body = Mode.Fully)]
9090
public async Task DeleteUser(Guid id, CancellationToken cancellationToken = default)
9191
{
92-
var user = await _dbContext.Users.SingleOrDefaultAsync(x => x.Id == id, cancellationToken);
92+
var user = await _dbContext.User.SingleOrDefaultAsync(x => x.Id == id, cancellationToken);
9393
if (user is null)
9494
{
9595
throw new NotFoundException($"Could not find User '{id}'");
9696
}
9797

98-
_dbContext.Users.Remove(user);
98+
_dbContext.User.Remove(user);
9999
}
100100

101101
[IntentManaged(Mode.Fully)]

0 commit comments

Comments
 (0)