60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using e_suite.Database.Core.Tables.Forms;
|
|
using e_suite.Database.Core.Tables.Printer;
|
|
using e_suite.Modules.SpecificationManager.UnitTests.Helpers;
|
|
using e_suite.Utilities.Pagination;
|
|
using NUnit.Framework;
|
|
|
|
namespace e_suite.Modules.SpecificationManager.UnitTests;
|
|
|
|
[TestFixture]
|
|
public class GetSpecificationsUnitTests : SpecificationManagerTestBase
|
|
{
|
|
[SetUp]
|
|
public override async Task Setup()
|
|
{
|
|
await base.Setup();
|
|
}
|
|
|
|
[Test]
|
|
public async Task GetSpecifications()
|
|
{
|
|
//Arrange
|
|
var paging = new Paging();
|
|
|
|
var formInstance = new FormInstance()
|
|
{
|
|
Guid = new Guid("43f9a0ce-cf50-4196-897d-530bc48900ed"),
|
|
Id = 2135
|
|
};
|
|
FormRepository.FormInstances.Add(formInstance);
|
|
|
|
var site = new Site
|
|
{
|
|
Guid = new Guid("245f4f92-7589-472f-8d21-507335ef69e6"),
|
|
Id = 13245,
|
|
Name = "My Site"
|
|
};
|
|
|
|
var specification = new Specification
|
|
{
|
|
Guid = new Guid("1f3e7a69-0834-42fb-800c-ec54163d4187"),
|
|
Id = 11213,
|
|
Name = "My Example Spec",
|
|
Site = site,
|
|
SiteId = site.Id,
|
|
FormInstanceId = formInstance.Id
|
|
};
|
|
SpecificationManagerRepository.Specifications.Add(specification);
|
|
|
|
//Act
|
|
var result = await SpecificationManager.GetSpecifications(paging, CancellationToken.None);
|
|
|
|
//Assert
|
|
Assert.That(result, Is.Not.Null);
|
|
Assert.That(result.Count, Is.EqualTo(1));
|
|
Assert.That(result.Data.Count(), Is.EqualTo(1));
|
|
|
|
var first = result.Data.First();
|
|
Assert.That(first.Guid, Is.EqualTo(specification.Guid));
|
|
}
|
|
} |