Files
ReC/tests/ReC.Tests/Application/Results/ResultQueryTests.cs
TekH 39d1292cc9 refactor: simplify test code in ResultQueryTests
- Remove unnecessary try-catch block in ShouldRead_Invalid_RecActionView test
- Code now directly awaits the query execution without exception handling
- Improves test readability and clarity
2026-08-03 17:11:36 +02:00

36 lines
952 B
C#

using DigitalData.Core.Exceptions;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using ReC.Application.Results.Queries;
using ReC.Tests.Application;
namespace ReC.Tests.Application.Results;
[TestFixture]
public class ResultQueryTests : RecApplicationTestBase
{
private (ISender Sender, IServiceScope Scope) CreateScopedSender()
{
var scope = ServiceProvider.CreateScope();
var sender = scope.ServiceProvider.GetRequiredService<ISender>();
return (sender, scope);
}
[Test]
public async Task ReadResultViewQuery_with_unknown_action_allows_not_found()
{
var (sender, scope) = CreateScopedSender();
using var _ = scope;
var invalidActionId = long.MaxValue;
await sender.Send(new ReadResultViewQuery
{
ActionId = invalidActionId
});
Assert.Pass("Read completed for unknown action id.");
}
}