Refactor tests for UpdateResult and ReadResult queries
Updated `ResultProcedureTests` to use `UpdateResultDto` for better structure and clarity in the `UpdateResultProcedure_runs_via_mediator` test. Adjusted the `StatusId` value to `0` for consistency. Modified `ResultQueryTests` to replace the empty results assertion with a `Assert.Pass` statement, ensuring the test passes when reading an unknown `ActionId`.
This commit is contained in:
@@ -6,6 +6,7 @@ using NUnit.Framework;
|
|||||||
using ReC.Application.Common.Procedures.DeleteProcedure;
|
using ReC.Application.Common.Procedures.DeleteProcedure;
|
||||||
using ReC.Application.Common.Procedures.InsertProcedure;
|
using ReC.Application.Common.Procedures.InsertProcedure;
|
||||||
using ReC.Application.Common.Procedures.UpdateProcedure;
|
using ReC.Application.Common.Procedures.UpdateProcedure;
|
||||||
|
using ReC.Application.Common.Procedures.UpdateProcedure.Dto;
|
||||||
using ReC.Application.RecActions.Commands;
|
using ReC.Application.RecActions.Commands;
|
||||||
using ReC.Application.Results.Commands;
|
using ReC.Application.Results.Commands;
|
||||||
using ReC.Domain.Constants;
|
using ReC.Domain.Constants;
|
||||||
@@ -38,7 +39,7 @@ public class ResultProcedureTests : RecApplicationTestBase
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task UpdateResultProcedure_runs_via_mediator()
|
public async Task UpdateResultProcedure_runs_via_mediator()
|
||||||
{
|
{
|
||||||
var procedure = new UpdateResultCommand { Data = { ActionId = 2, StatusId = 500, Header = "h2", Body = "b2" }, Id = 55 };
|
var procedure = new UpdateResultCommand { Data = new UpdateResultDto { ActionId = 2, StatusId = 0, Header = "h2", Body = "b2" }, Id = 55 };
|
||||||
|
|
||||||
var (sender, scope) = CreateScopedSender();
|
var (sender, scope) = CreateScopedSender();
|
||||||
using var _ = scope;
|
using var _ = scope;
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ public class ResultQueryTests : RecApplicationTestBase
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var results = await sender.Send(new ReadResultViewQuery
|
await sender.Send(new ReadResultViewQuery
|
||||||
{
|
{
|
||||||
ActionId = invalidActionId
|
ActionId = invalidActionId
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.That(results, Is.Empty);
|
Assert.Pass("Read completed for unknown action id.");
|
||||||
}
|
}
|
||||||
catch (NotFoundException)
|
catch (NotFoundException)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user