TapiDirectoryRepository Tests
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
|
namespace CPATapi.Server.Tests;
|
||||||
|
|
||||||
|
public class RepositoryTestsBase
|
||||||
|
{
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
// the type specified here is just so the secrets library can
|
||||||
|
// find the UserSecretId we added in the csproj file
|
||||||
|
var builder = new ConfigurationBuilder().AddUserSecrets<RepositoryTestsBase>();
|
||||||
|
|
||||||
|
Configuration = builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected IConfigurationRoot Configuration { get; private set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using CPATapi.Server.Repository;
|
||||||
|
|
||||||
|
namespace CPATapi.Server.Tests;
|
||||||
|
|
||||||
|
public class TapiDirectoryRepositoryTests : RepositoryTestsBase
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public async Task TestGetAllAsync()
|
||||||
|
{
|
||||||
|
var tdRepo = new TapiDirectoryRepository(Configuration);
|
||||||
|
var contacts = (await tdRepo.GetAllAsync()).ToList();
|
||||||
|
Assert.That(contacts, Is.Not.Empty);
|
||||||
|
Assert.That(contacts, Has.Count.GreaterThan(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,26 +1,13 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using CPATapi.Server.Repository;
|
using CPATapi.Server.Repository;
|
||||||
|
|
||||||
namespace CPATapi.Server.Tests;
|
namespace CPATapi.Server.Tests;
|
||||||
|
|
||||||
public class ZeitConsensRepositoryTest
|
public class ZeitConsensRepositoryTest : RepositoryTestsBase
|
||||||
{
|
{
|
||||||
[OneTimeSetUp]
|
|
||||||
public void Setup()
|
|
||||||
{
|
|
||||||
// the type specified here is just so the secrets library can
|
|
||||||
// find the UserSecretId we added in the csproj file
|
|
||||||
var builder = new ConfigurationBuilder().AddUserSecrets<ZeitConsensRepositoryTest>();
|
|
||||||
|
|
||||||
_configuration = builder.Build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IConfigurationRoot _configuration { get; set; }
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public async Task TestGetUsersAvailabilityAsync()
|
public async Task TestGetUsersAvailabilityAsync()
|
||||||
{
|
{
|
||||||
var zcRepo = new ZeitConsensRepository(_configuration);
|
var zcRepo = new ZeitConsensRepository(Configuration);
|
||||||
var availability= (await zcRepo.GetUsersAvailabilityAsync(DateTime.Now.Date, DateTime.Now.AddDays(1).Date)).ToList();
|
var availability= (await zcRepo.GetUsersAvailabilityAsync(DateTime.Now.Date, DateTime.Now.AddDays(1).Date)).ToList();
|
||||||
Assert.That(availability, Is.Not.Empty);
|
Assert.That(availability, Is.Not.Empty);
|
||||||
Assert.That(availability, Has.Count.GreaterThan(1));
|
Assert.That(availability, Has.Count.GreaterThan(1));
|
||||||
@@ -29,7 +16,7 @@ public class ZeitConsensRepositoryTest
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestGetUserAvailabilityAsync()
|
public async Task TestGetUserAvailabilityAsync()
|
||||||
{
|
{
|
||||||
var zcRepo = new ZeitConsensRepository(_configuration);
|
var zcRepo = new ZeitConsensRepository(Configuration);
|
||||||
var availability = await zcRepo.GetUserAvailabilityAsync("CPATRD", DateTime.Now.Date, DateTime.Now.AddDays(1).Date);
|
var availability = await zcRepo.GetUserAvailabilityAsync("CPATRD", DateTime.Now.Date, DateTime.Now.AddDays(1).Date);
|
||||||
Assert.That(availability, Is.Not.Null);
|
Assert.That(availability, Is.Not.Null);
|
||||||
Assert.That(availability.MA_USER_NAME, Is.EqualTo("CPATRD"));
|
Assert.That(availability.MA_USER_NAME, Is.EqualTo("CPATRD"));
|
||||||
|
|||||||
Reference in New Issue
Block a user