using Shouldly;
using ZB.MOM.NatsNet.Server;

namespace ZB.MOM.NatsNet.Server.Tests;

public sealed partial class AccountTests
{
    [Fact]
    public void SamplingHeader_ShouldSucceed()
    {
        var stream = NatsStream.Create(
            new Account { Name = "A" },
            new StreamConfig { Name = "S", Subjects = ["events.>"] },
            null,
            null,
            null,
            null);
        stream.ShouldNotBeNull();

        var consumer = NatsConsumer.Create(
            stream!,
            new ConsumerConfig { Durable = "D", AckPolicy = AckPolicy.AckExplicit, SampleFrequency = "100%" },
            ConsumerAction.Create,
            null);
        consumer.ShouldNotBeNull();

        consumer!.ShouldSample().ShouldBeTrue();
        consumer.SampleAck("$JS.ACK.S.D.1").ShouldBeTrue();
    }
}
