public async Task StartNow_ExecutesEventImmediately() { var timer = new FfsTimer(); timer.Elapsed += ActionToPerform; timer.StartNow(100000); timer.Stop(); _numberOfExecutions.Should().Be(1); }
public async Task StartNow_ExecutesFurtherEvents() { var timer = new FfsTimer(); timer.Elapsed += ActionToPerform; timer.StartNow(1000); await Task.Delay(1000); timer.Stop(); _numberOfExecutions.Should().Be(2); }
public async Task Start_ExecutesScheduledEvent(int msBetweenExecutions, int numberOfExecutions) { var timer = new FfsTimer(); timer.Elapsed += ActionToPerform; timer.Start(msBetweenExecutions); for (int i = 0; i < numberOfExecutions; i++) { await Task.Delay(msBetweenExecutions); } timer.Stop(); _numberOfExecutions.Should().Be(numberOfExecutions); }