using e_suite.API.Common.models;
using e_suite.Database.Audit;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;

namespace eSuite.API.UnitTests.Controllers.DomainControllerUnitTests;

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

    [Test]
    public async Task GetDomain_WhenCalled_ReturnsOKResult()
    {
        //Arrange
        var createDomain = new CreateDomain
        {
            Guid = new Guid("f6bfa906-a4f6-41a0-bbad-06b77af8ac50")
        };

        var cancellationToken = CancellationToken.None;

        //Act
        var actualResult = await _domainController.CreateDomain(createDomain, cancellationToken);

        //Assert
        _domainManagerMock.Verify(x => x.CreateDomainAsync(It.IsAny<AuditUserDetails>(), createDomain, cancellationToken), Times.Once);

        Assert.That(actualResult.GetType(), Is.EqualTo(typeof(OkResult)));
    }
}