Files
ReC/tests/ReC.Tests/Application/Profile/ProfileProcedureTests.cs
TekH de503cac5b Rename Profile*Procedure types to Profile*Command for clarity
Renamed InsertProfileProcedure, UpdateProfileProcedure, and DeleteProfileProcedure (and their handlers) to use the "Command" suffix for consistency. Updated all usages in controllers, handlers, and tests. No logic changes; only type names were updated for improved clarity.
2026-03-24 11:39:04 +01:00

59 lines
1.8 KiB
C#

using System.Threading.Tasks;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using ReC.Application.Common.Procedures.DeleteProcedure;
using ReC.Application.Common.Procedures.InsertProcedure;
using ReC.Application.Common.Procedures.UpdateProcedure;
using ReC.Application.Profile.Commands;
using ReC.Tests.Application;
namespace ReC.Tests.Application.Profile;
[TestFixture]
public class ProfileProcedureTests : RecApplicationTestBase
{
private (ISender Sender, IServiceScope Scope) CreateScopedSender()
{
var scope = ServiceProvider.CreateScope();
var sender = scope.ServiceProvider.GetRequiredService<ISender>();
return (sender, scope);
}
[Test]
public async Task InsertProfileProcedure_runs_via_mediator()
{
var procedure = new InsertProfileCommand { Active = true, TypeId = 1, Name = "name", Mandantor = "man" };
var (sender, scope) = CreateScopedSender();
using var _ = scope;
var result = await sender.Send(procedure);
Assert.That(result, Is.GreaterThan(0));
}
[Test]
public async Task UpdateProfileProcedure_runs_via_mediator()
{
var procedure = new UpdateProfileCommand { Data = { Active = false, TypeId = 2, Name = "updated", Mandantor = "man2" }, Id = 45 };
var (sender, scope) = CreateScopedSender();
using var _ = scope;
var result = await sender.Send(procedure);
Assert.That(result, Is.Not.EqualTo(default(int)));
}
[Test]
public async Task DeleteProfileProcedure_runs_via_mediator()
{
var procedure = new DeleteProfileCommand { Start = 9, End = 10, Force = false };
var (sender, scope) = CreateScopedSender();
using var _ = scope;
var result = await sender.Send(procedure);
Assert.That(result, Is.Not.EqualTo(default(int)));
}
}