using e_suite.Messaging.Common;
using e_suite.Scheduler.Jobs;
using e_suite.UnitTestCore;
using Microsoft.Extensions.Logging;
using Moq;
using NUnit.Framework;

namespace e_suite.MessageProcessor.UnitTests;

[TestFixture]
public class NightlySigmaImportUnitTests : TestBase
{
    protected Mock<ISigmaImportMessageSender> SigmaImportMessageSenderMock { get; set; } = null!;
    protected Mock<ILogger> LoggerMock { get; set; } = null!;
    protected NightlySigmaImport NightlySigmaImport { get; set; } = null!;

    [SetUp]
    public override Task Setup()
    {
        SigmaImportMessageSenderMock = new Mock<ISigmaImportMessageSender>();
        LoggerMock = new Mock<ILogger>();

        NightlySigmaImport = new NightlySigmaImport(SigmaImportMessageSenderMock.Object, LoggerMock.Object);

        return base.Setup();
    }

    [Test]
    public async Task NightlyCleanUp_WhenCalled_InvokesExpectedMaintenanceMethods()
    {
        //Arrange

        //Act
        await NightlySigmaImport.ExecuteAsync();

        //Assert
        SigmaImportMessageSenderMock.Verify(x => x.PostImportGMGProfiles(), Times.Once);
        SigmaImportMessageSenderMock.Verify(x => x.PostImportPrintSpecifications(), Times.Once);
    }

}