Skip to content

Commit 3c3f612

Browse files
committed
chore: minor improvements
1 parent 1b1f3e8 commit 3c3f612

File tree

7 files changed

+13
-17
lines changed

7 files changed

+13
-17
lines changed

Modules/Quotas/src/Quotas.Application/DTOs/IndividualQuotaDTO.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Backbone.Modules.Quotas.Domain.Aggregates.Identities;
2-
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;
32

43
namespace Backbone.Modules.Quotas.Application.DTOs;
54

Modules/Quotas/src/Quotas.Application/DTOs/MetricDTO.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using AutoMapper;
2-
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.Mapping;
3-
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;
1+
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;
42

53
namespace Backbone.Modules.Quotas.Application.DTOs;
64

Modules/Quotas/src/Quotas.Application/Metrics/Queries/ListMetrics/Handler.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
using AutoMapper;
2-
using Backbone.Modules.Quotas.Application.DTOs;
1+
using Backbone.Modules.Quotas.Application.DTOs;
32
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
43
using MediatR;
54

65
namespace Backbone.Modules.Quotas.Application.Metrics.Queries.ListMetrics;
76
public class Handler : IRequestHandler<ListMetricsQuery, ListMetricsResponse>
87
{
9-
private readonly IMapper _mapper;
108
private readonly IMetricsRepository _metricsRepository;
119

12-
public Handler(IMapper mapper, IMetricsRepository metricsRepository)
10+
public Handler(IMetricsRepository metricsRepository)
1311
{
14-
_mapper = mapper;
1512
_metricsRepository = metricsRepository;
1613
}
1714

Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ private Identity()
2020
_tierQuotas = null!;
2121
_individualQuotas = null!;
2222
_metricStatuses = null!;
23+
Address = null!;
24+
TierId = null!;
2325
}
2426

2527
public Identity(string address, TierId tierId)
@@ -31,8 +33,8 @@ public Identity(string address, TierId tierId)
3133
_metricStatuses = new List<MetricStatus>();
3234
}
3335

34-
public string Address { get; } = null!;
35-
public TierId TierId { get; private set; } = null!;
36+
public string Address { get; }
37+
public TierId TierId { get; private set; }
3638

3739
public IReadOnlyCollection<MetricStatus> MetricStatuses => _metricStatuses.AsReadOnly();
3840

Modules/Quotas/test/Quotas.Application.Tests/TestDoubles/AddMockTiersRepository.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
1+
using System.Diagnostics.CodeAnalysis;
2+
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
23
using Backbone.Modules.Quotas.Domain.Aggregates.Tiers;
34

45
namespace Backbone.Modules.Quotas.Application.Tests.TestDoubles;
56
public class AddMockTiersRepository : ITiersRepository
67
{
7-
public bool WasCalled { get; private set; }
8-
public Tier WasCalledWith { get; private set; } = null!;
8+
[MemberNotNullWhen(true, nameof(WasCalledWith))]
9+
public bool WasCalled => WasCalledWith != null;
10+
public Tier? WasCalledWith { get; private set; }
911

1012
public Task Add(Tier tier, CancellationToken cancellationToken)
1113
{
12-
WasCalled = true;
1314
WasCalledWith = tier;
1415
return Task.CompletedTask;
1516
}

Modules/Quotas/test/Quotas.Application.Tests/Tests/Repositories/MessagesRepositoryTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Backbone.DevelopmentKit.Identity.ValueObjects;
22
using Backbone.Modules.Messages.Domain.Entities;
33
using Backbone.Modules.Messages.Infrastructure.Persistence.Database;
4-
using Backbone.Modules.Quotas.Domain.Aggregates;
54
using Backbone.Modules.Quotas.Domain.Aggregates.Identities;
65
using Backbone.Modules.Quotas.Infrastructure.Persistence.Database;
76
using Backbone.Modules.Quotas.Infrastructure.Persistence.Repository;

Modules/Quotas/test/Quotas.Application.Tests/Tests/Tiers/TierCreatedIntegrationEventHandlerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async void Creates_tier_after_consuming_integration_event()
2323

2424
// Assert
2525
mockTierRepository.WasCalled.Should().BeTrue();
26-
mockTierRepository.WasCalledWith.Id.Should().Be(id);
26+
mockTierRepository.WasCalledWith!.Id.Should().Be(id);
2727
mockTierRepository.WasCalledWith.Name.Should().Be(name);
2828
}
2929

0 commit comments

Comments
 (0)