using e_suite.API.Common.models;
using e_suite.Utilities.Pagination;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;

namespace eSuite.API.UnitTests.Controllers.ExceptionLogsControllerUnitTest;

[TestFixture]
public class GetExceptionLogsUnitTests: ExceptionLogsControllerTestBase
{
    [SetUp]
    public override async Task Setup()
    {
        await base.Setup();
    }

    [Test]
    public async Task GetBlockedIPs_NormalConditions_ReturnsOkObjResult()
    {
        //Arrange
        var paginatedData = new PaginatedData<ExceptionLog>
        {
            Count = 2,
            Data = new List<ExceptionLog> { new() },
            Page = 1,
            PageSize = 10
        };

        _exceptionLogManagerMock?.Setup(x => x.GetExceptionLogs(It.IsAny<Paging>(), It.IsAny<CancellationToken>())).ReturnsAsync(paginatedData);

        var paging = new Paging();

        //Act
        var res = await _exceptionLogsController.Get(paging);

        //Assert
        Assert.That(res, Is.Not.Null);
        Assert.That(res?.GetType(), Is.EqualTo(typeof(OkObjectResult)));
    }
}
