Skip to content

Commit

Permalink
Change type to enable prevalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristian F. Thomsen committed Mar 20, 2023
1 parent 1b96c90 commit ec1191d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion source/Api/OutgoingMessages/DequeueRequestListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public async Task<HttpResponseData> RunAsync(
FunctionContext executionContext,
string messageId)
{
var result = await _mediator.Send(new DequeueRequest(Guid.Parse(messageId))).ConfigureAwait(false);
var result = await _mediator.Send(new DequeueRequest(messageId)).ConfigureAwait(false);
return result.Success
? request.CreateResponse(HttpStatusCode.OK)
: request.CreateResponse(HttpStatusCode.BadRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public Task<DequeueResult> Handle(DequeueRequest request, CancellationToken canc
{
ArgumentNullException.ThrowIfNull(request);

return _bundledMessages.DequeueAsync(request.MessageId);
return _bundledMessages.DequeueAsync(Guid.Parse(request.MessageId));
}
}

public record DequeueRequest(Guid MessageId) : ICommand<DequeueResult>;
public record DequeueRequest(string MessageId) : ICommand<DequeueResult>;

public record DequeueResult(bool Success);
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public WhenADequeueIsRequestedTests(DatabaseFixture databaseFixture)
[Fact]
public async Task Dequeue_is_unsuccessful_when_bundle_does_not_exist()
{
var dequeueResult = await InvokeCommandAsync(new DequeueRequest(Guid.NewGuid())).ConfigureAwait(false);
var dequeueResult = await InvokeCommandAsync(new DequeueRequest(Guid.NewGuid().ToString())).ConfigureAwait(false);

Assert.False(dequeueResult.Success);
}
Expand All @@ -50,7 +50,7 @@ public async Task Dequeue_is_Successful()
ActorNumber.Create(SampleData.NewEnergySupplierNumber),
MessageCategory.MasterData)).ConfigureAwait(false);

var dequeueResult = await InvokeCommandAsync(new DequeueRequest(peekResult.MessageId.GetValueOrDefault())).ConfigureAwait(false);
var dequeueResult = await InvokeCommandAsync(new DequeueRequest(peekResult.MessageId.GetValueOrDefault().ToString())).ConfigureAwait(false);

using var connection = await GetService<IDatabaseConnectionFactory>().GetConnectionAndOpenAsync().ConfigureAwait(false);
var found = await connection
Expand Down

0 comments on commit ec1191d

Please sign in to comment.