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(); 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; try { var results = await sender.Send(new ReadResultViewQuery { ActionId = invalidActionId }); Assert.That(results, Is.Empty); } catch (NotFoundException) { Assert.Pass("NotFound is acceptable for unknown action"); } } }