Backend/e-suite.API/eSuite.API.UnitTests/Controllers/SpecificationControllerUnitTests/GetTemplateForPrintSpecUnitTests.cs
2026-01-20 21:50:10 +00:00

40 lines
1.3 KiB
C#

using eSuite.Core.Miscellaneous;
using Microsoft.AspNetCore.Mvc;
using Moq;
using NUnit.Framework;
namespace eSuite.API.UnitTests.Controllers.SpecificationControllerUnitTests;
[TestFixture]
public class GetTemplateForPrintSpecUnitTests : SpecificationControllerTestBase
{
[SetUp]
public override async Task Setup()
{
await base.Setup();
}
[Test]
public async Task GetTemplateForPrintSpec_WhenCalled_ReturnsPagedData()
{
//Arrange
var templateGeneralIdRef = new GeneralIdRef();
var cancellationToken = CancellationToken.None;
var generalIdRef = new GeneralIdRef();
_specificationManagerMock.Setup(x => x.GetTemplateForPrintSpec(generalIdRef, cancellationToken)).ReturnsAsync(templateGeneralIdRef);
//Act
var actualResult = await _specificationController.GetTemplateForPrintSpec(generalIdRef, cancellationToken);
//Assert
Assert.That(actualResult.GetType(), Is.EqualTo(typeof(OkObjectResult)));
var objectResult = actualResult as OkObjectResult;
Assert.That(objectResult?.StatusCode, Is.EqualTo(200));
Assert.That(objectResult?.Value, Is.Not.Null);
Assert.That(objectResult!.Value!.GetType, Is.EqualTo(typeof(GeneralIdRef)));
}
}