Skip to content

Commit

Permalink
chore: minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tnotheis committed Feb 12, 2024
1 parent 1b1f3e8 commit 3c3f612
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Backbone.Modules.Quotas.Domain.Aggregates.Identities;
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;

namespace Backbone.Modules.Quotas.Application.DTOs;

Expand Down
4 changes: 1 addition & 3 deletions Modules/Quotas/src/Quotas.Application/DTOs/MetricDTO.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using AutoMapper;
using Backbone.BuildingBlocks.Application.Abstractions.Infrastructure.Mapping;
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;
using Backbone.Modules.Quotas.Domain.Aggregates.Metrics;

namespace Backbone.Modules.Quotas.Application.DTOs;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
using AutoMapper;
using Backbone.Modules.Quotas.Application.DTOs;
using Backbone.Modules.Quotas.Application.DTOs;
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
using MediatR;

namespace Backbone.Modules.Quotas.Application.Metrics.Queries.ListMetrics;
public class Handler : IRequestHandler<ListMetricsQuery, ListMetricsResponse>
{
private readonly IMapper _mapper;
private readonly IMetricsRepository _metricsRepository;

public Handler(IMapper mapper, IMetricsRepository metricsRepository)
public Handler(IMetricsRepository metricsRepository)
{
_mapper = mapper;
_metricsRepository = metricsRepository;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ private Identity()
_tierQuotas = null!;
_individualQuotas = null!;
_metricStatuses = null!;
Address = null!;
TierId = null!;
}

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

public string Address { get; } = null!;
public TierId TierId { get; private set; } = null!;
public string Address { get; }
public TierId TierId { get; private set; }

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
using System.Diagnostics.CodeAnalysis;
using Backbone.Modules.Quotas.Application.Infrastructure.Persistence.Repository;
using Backbone.Modules.Quotas.Domain.Aggregates.Tiers;

namespace Backbone.Modules.Quotas.Application.Tests.TestDoubles;
public class AddMockTiersRepository : ITiersRepository
{
public bool WasCalled { get; private set; }
public Tier WasCalledWith { get; private set; } = null!;
[MemberNotNullWhen(true, nameof(WasCalledWith))]
public bool WasCalled => WasCalledWith != null;
public Tier? WasCalledWith { get; private set; }

public Task Add(Tier tier, CancellationToken cancellationToken)
{
WasCalled = true;
WasCalledWith = tier;
return Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Backbone.DevelopmentKit.Identity.ValueObjects;
using Backbone.Modules.Messages.Domain.Entities;
using Backbone.Modules.Messages.Infrastructure.Persistence.Database;
using Backbone.Modules.Quotas.Domain.Aggregates;
using Backbone.Modules.Quotas.Domain.Aggregates.Identities;
using Backbone.Modules.Quotas.Infrastructure.Persistence.Database;
using Backbone.Modules.Quotas.Infrastructure.Persistence.Repository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public async void Creates_tier_after_consuming_integration_event()

// Assert
mockTierRepository.WasCalled.Should().BeTrue();
mockTierRepository.WasCalledWith.Id.Should().Be(id);
mockTierRepository.WasCalledWith!.Id.Should().Be(id);
mockTierRepository.WasCalledWith.Name.Should().Be(name);
}

Expand Down

0 comments on commit 3c3f612

Please sign in to comment.