mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-06-30 02:31:08 +00:00
27 lines
860 B
C#
27 lines
860 B
C#
using CleanArchitecture.Domain.Interfaces;
|
|
using CleanArchitecture.Domain.Notifications;
|
|
using NSubstitute;
|
|
|
|
namespace CleanArchitecture.Application.Tests.Fixtures.Queries;
|
|
|
|
public class QueryHandlerBaseFixture
|
|
{
|
|
public IMediatorHandler Bus { get; } = Substitute.For<IMediatorHandler>();
|
|
|
|
public QueryHandlerBaseFixture VerifyExistingNotification(string key, string errorCode, string message)
|
|
{
|
|
Bus.Received(1).RaiseEventAsync(Arg.Is<DomainNotification>(notification =>
|
|
notification.Key == key &&
|
|
notification.Code == errorCode &&
|
|
notification.Value == message));
|
|
|
|
return this;
|
|
}
|
|
|
|
public QueryHandlerBaseFixture VerifyNoDomainNotification()
|
|
{
|
|
Bus.DidNotReceive().RaiseEventAsync(Arg.Any<DomainNotification>());
|
|
|
|
return this;
|
|
}
|
|
} |