using Managing.Application.Shared;
using Xunit;
using static Managing.Common.Enums;

namespace Managing.Application.Tests;

public class GrainHelpersTests
{
    [Fact]
    public void GetIntervalMinutes_FifteenMinutes_ShouldReturn75()
    {
        var result = GrainHelpers.GetIntervalMinutes(Timeframe.FifteenMinutes);
        Assert.Equal(7.5, result);
    }

    [Fact]
    public void GetRandomizedTimerOptions_OneHour_ShouldReturn30()
    {
        var result = GrainHelpers.GetDynamicRandomizedTimerOptions(TimeSpan.FromMinutes(1), 200);
        Assert.True(result.period.TotalSeconds <= 60.0);
        Assert.True(result.dueTime.TotalSeconds <= 60.0);

        Assert.True(result.period.TotalSeconds > 0.0);
        Assert.True(result.dueTime.TotalSeconds > 0.0);
    }
}