using NSubstitute;
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications;
using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories;
namespace ZB.MOM.WW.ScadaBridge.NotificationOutbox.Tests;
///
/// Factory for the outbox repository substitute used across these tests.
///
///
/// returns whether the
/// targeted UPDATE actually matched a row — false is the "this
/// notification no longer exists" signal the operator retry/discard handlers
/// turn into a not-found reply. NSubstitute's default for Task<bool>
/// is false, i.e. the VANISHED-row answer, so an unconfigured substitute
/// would silently put every test on the failure path. Tests that want a healthy
/// store take one from here; the vanished-row tests configure
/// Returns(false) for themselves.
///
internal static class OutboxRepositorySubstitute
{
/// Creates a substitute whose writes report that the row was found.
public static INotificationOutboxRepository Healthy()
{
var repository = Substitute.For();
repository
.UpdateAsync(Arg.Any(), Arg.Any())
.Returns(true);
return repository;
}
}