using e_suite.Modules.BlockedIPsManager.UnitTests.Helpers;
using NUnit.Framework;

namespace e_suite.Modules.BlockedIPsManager.UnitTests;

public class GetUnlockedMinutesUnitTests : BlockedIPsManagerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();
    }

    [Test]
    public void GetUnlockedMinutes_WhenCalled_ReturnsExpectedResult()
    {
        //Arrange
        var attemptedTime = new DateTimeOffset(DateTime.UtcNow.Subtract(new TimeSpan(10)));
        var dateTimeNow = new DateTimeOffset(DateTime.UtcNow);
        //Act
        var result = BlockedIPsManager.GetUnlockedMinutes(attemptedTime, 60, dateTimeNow);

        //Assert
        Assert.That(result, Is.Positive);
        Assert.That(result, Is.EqualTo(59));
        Assert.Pass();
    }
}
