Closed nblumhardt closed 8 months ago
I would also add a test case to test for EagerlyEmitFirstEvent = false
something like this (untested):
[Fact]
public async Task WhenEagerlyEmitFirstEventIsFalseItShouldNotWriteToBatchImmediately()
{
var eventEmitted = false;
var bs = new CallbackBatchedSink(_ =>
{
eventEmitted = true;
return Task.CompletedTask;
});
var options = new PeriodicBatchingSinkOptions
{
Period = TimeSpan.FromSeconds(2),
EagerlyEmitFirstEvent = false,
BatchSizeLimit = 10,
QueueLimit = 1000
};
#if FEATURE_ASYNCDISPOSABLE
await
#endif
using var pbs = new PeriodicBatchingSink(bs, options);
var evt = Some.InformationEvent();
pbs.Emit(evt);
await Task.Delay(100);
Assert.False(eventEmitted);
}
Changed to a theory so we can test the true/false cases together 👍
Fixes #70