- 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
36 lines
952 B
C#
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.");
|
|
}
|
|
}
|