Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lamar" Version="15.0.0" />
<PackageReference Include="Lamar" Version="15.0.1" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NLog.Extensions.Logging" Version="5.5.0" />
<PackageReference Include="MediatR" Version="12.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.5" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="6.0.5" />
<PackageReference Include="MediatR" Version="13.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="9.0.0" />
<PackageReference Include="SimpleResults" Version="4.0.0" />
</ItemGroup>

Expand All @@ -20,4 +20,8 @@
<ProjectReference Include="..\MessagingService.SMSMessageAggregate\MessagingService.SMSMessageAggregate.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Common\" />
</ItemGroup>

</Project>
15 changes: 0 additions & 15 deletions MessagingService.Client/IMessagingServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ namespace MessagingService.Client
public interface IMessagingServiceClient
{
#region Methods

/// <summary>
/// Sends the email.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task<Result> SendEmail(String accessToken,
SendEmailRequest request,
CancellationToken cancellationToken);
Expand All @@ -29,13 +21,6 @@ Task<Result> ResendEmail(String accessToken,
ResendEmailRequest request,
CancellationToken cancellationToken);

/// <summary>
/// Sends the SMS.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="request">The request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
Task<Result> SendSMS(String accessToken,
SendSMSRequest request,
CancellationToken cancellationToken);
Expand Down
6 changes: 3 additions & 3 deletions MessagingService.Client/MessagingService.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="2025.7.13" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Shared.Results" Version="2025.7.13" />
<PackageReference Include="ClientProxyBase" Version="2025.10.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
<PackageReference Include="Shared.Results" Version="2025.10.2" />
</ItemGroup>

<ItemGroup>
Expand Down
77 changes: 4 additions & 73 deletions MessagingService.Client/MessagingServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,18 @@
using Newtonsoft.Json;
using SimpleResults;

/// <summary>
///
/// </summary>
/// <seealso cref="ClientProxyBase" />
/// <seealso cref="MessagingService.Client.IMessagingServiceClient" />
public class MessagingServiceClient : ClientProxyBase, IMessagingServiceClient
{
#region Fields

/// <summary>
/// The base address
/// </summary>
private readonly String BaseAddress;

Check warning on line 20 in MessagingService.Client/MessagingServiceClient.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

The field 'MessagingServiceClient.BaseAddress' is never used

Check warning on line 20 in MessagingService.Client/MessagingServiceClient.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

The field 'MessagingServiceClient.BaseAddress' is never used

/// <summary>
/// The base address resolver
/// </summary>
private readonly Func<String, String> BaseAddressResolver;

#endregion

#region Constructors

/// <summary>
/// Initializes a new instance of the <see cref="MessagingServiceClient"/> class.
/// </summary>
/// <param name="baseAddressResolver">The base address resolver.</param>
/// <param name="httpClient">The HTTP client.</param>
public MessagingServiceClient(Func<String, String> baseAddressResolver,
HttpClient httpClient) : base(httpClient)
{
Expand All @@ -51,13 +35,6 @@

#region Methods

/// <summary>
/// Sends the email.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="sendEmailRequest">The send email request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<Result> SendEmail(String accessToken,
SendEmailRequest sendEmailRequest,
CancellationToken cancellationToken)
Expand All @@ -66,19 +43,8 @@

try
{
String requestSerialised = JsonConvert.SerializeObject(sendEmailRequest);

StringContent httpContent = new(requestSerialised, Encoding.UTF8, "application/json");

// Add the access token to the client headers
this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.PostAsync(requestUri, httpContent, cancellationToken);

// Process the response
Result<String> result = await this.HandleResponseX(httpResponse, cancellationToken);

Result<ResponseData<String>> result = await this.SendPostRequest<SendEmailRequest, ResponseData<String>>(requestUri, accessToken, sendEmailRequest, cancellationToken);

if (result.IsFailed)
return ResultHelpers.CreateFailure(result);

Expand All @@ -99,18 +65,7 @@
String requestUri = this.BuildRequestUrl("/api/email/resend");

try {
String requestSerialised = JsonConvert.SerializeObject(resendEmailRequest);

StringContent httpContent = new(requestSerialised, Encoding.UTF8, "application/json");

// Add the access token to the client headers
this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.PostAsync(requestUri, httpContent, cancellationToken);

// Process the response
Result<String> result = await this.HandleResponseX(httpResponse, cancellationToken);
Result<ResponseData<String>> result = await this.SendPostRequest<ResendEmailRequest, ResponseData<String>>(requestUri, accessToken, resendEmailRequest, cancellationToken);

if (result.IsFailed)
return ResultHelpers.CreateFailure(result);
Expand All @@ -125,13 +80,6 @@
}
}

/// <summary>
/// Sends the SMS.
/// </summary>
/// <param name="accessToken">The access token.</param>
/// <param name="sendSMSRequest">The send SMS request.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns></returns>
public async Task<Result> SendSMS(String accessToken,
SendSMSRequest sendSMSRequest,
CancellationToken cancellationToken)
Expand All @@ -140,18 +88,7 @@

try
{
String requestSerialised = JsonConvert.SerializeObject(sendSMSRequest);

StringContent httpContent = new(requestSerialised, Encoding.UTF8, "application/json");

// Add the access token to the client headers
this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);

// Make the Http Call here
HttpResponseMessage httpResponse = await this.HttpClient.PostAsync(requestUri, httpContent, cancellationToken);

// Process the response
Result<String> result = await this.HandleResponseX(httpResponse, cancellationToken);
Result<ResponseData<String>> result = await this.SendPostRequest<SendSMSRequest, ResponseData<String>>(requestUri, accessToken, sendSMSRequest, cancellationToken);

if (result.IsFailed)
return ResultHelpers.CreateFailure(result);
Expand All @@ -166,12 +103,6 @@
throw exception;
}
}

/// <summary>
/// Builds the request URL.
/// </summary>
/// <param name="route">The route.</param>
/// <returns></returns>
private String BuildRequestUrl(String route)
{
String baseAddress = this.BaseAddressResolver("MessagingServiceApi");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
<PackageReference Include="Shared.EventStore" Version="2025.7.13" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="Shared.EventStore" Version="2025.10.2" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared" Version="2025.7.13" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2025.7.13" />
<PackageReference Include="Shared" Version="2025.10.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2025.10.2" />
</ItemGroup>

</Project>
3 changes: 2 additions & 1 deletion MessagingService.EmailMessageAggregate/EmailAggregate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ public EmailAggregate()

private EmailAggregate(Guid aggregateId)
{
Guard.ThrowIfInvalidGuid(aggregateId, "Aggregate Id cannot be an Empty Guid");
if (aggregateId == Guid.Empty)
throw new ArgumentNullException(nameof(aggregateId));

this.AggregateId = aggregateId;
this.MessageId = aggregateId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.71.0" />
<PackageReference Include="Shared" Version="2025.7.13" />
<PackageReference Include="Shared.EventStore" Version="2025.7.13" />
<PackageReference Include="Shared" Version="2025.10.2" />
<PackageReference Include="Shared.EventStore" Version="2025.10.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared.IntegrationTesting" Version="2025.7.13" />
<PackageReference Include="Shared.IntegrationTesting" Version="2025.10.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MessagingService.IntegrationTests/Common/Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
public static (String url, String username, String password) DockerCredentials = ("https://www.docker.com", "stuartferguson", "Sc0tland");
static object padLock = new object(); // Object to lock on

public static async Task GlobalSetup(DockerHelper dockerHelper)

Check warning on line 23 in MessagingService.IntegrationTests/Common/Setup.cs

View workflow job for this annotation

GitHub Actions / Build and Test Pull Requests

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
ShouldlyConfiguration.DefaultTaskTimeout = TimeSpan.FromMinutes(1);
dockerHelper.SqlCredentials = Setup.SqlCredentials;
dockerHelper.DockerCredentials = Setup.DockerCredentials;
dockerHelper.SqlServerContainerName = "sharedsqlserver";

// Only one thread can execute this block at a time
lock (Setup.padLock)
{
Expand Down
Loading
Loading