diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/DataStore/Postgres/Models/MandatoryQualification.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/DataStore/Postgres/Models/MandatoryQualification.cs index 0ca10d6a1..929abd7c9 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Core/DataStore/Postgres/Models/MandatoryQualification.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/DataStore/Postgres/Models/MandatoryQualification.cs @@ -1,4 +1,3 @@ -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.TrsDataSync; namespace TeachingRecordSystem.Core.DataStore.Postgres.Models; diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/AlertCreatedEvent.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/AlertCreatedEvent.cs new file mode 100644 index 000000000..344866a46 --- /dev/null +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/AlertCreatedEvent.cs @@ -0,0 +1,9 @@ +using TeachingRecordSystem.Core.Events.Models; + +namespace TeachingRecordSystem.Core.Events; + +public record class AlertCreatedEvent : EventBase, IEventWithPersonId, IEventWithAlert +{ + public required Guid PersonId { get; init; } + public required Alert Alert { get; init; } +} diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/IEventWithAlert.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/IEventWithAlert.cs new file mode 100644 index 000000000..cb15dc895 --- /dev/null +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/IEventWithAlert.cs @@ -0,0 +1,8 @@ +using TeachingRecordSystem.Core.Events.Models; + +namespace TeachingRecordSystem.Core.Events; + +public interface IEventWithAlert +{ + Alert Alert { get; } +} diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/Models/Alert.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/Models/Alert.cs new file mode 100644 index 000000000..2b1d5a140 --- /dev/null +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/Events/Models/Alert.cs @@ -0,0 +1,21 @@ +namespace TeachingRecordSystem.Core.Events.Models; + +public record Alert +{ + public required Guid AlertId { get; init; } + public required Guid AlertTypeId { get; init; } + public required string? Details { get; init; } + public required string? ExternalLink { get; init; } + public required DateOnly? StartDate { get; init; } + public required DateOnly? EndDate { get; init; } + + public static Alert FromModel(DataStore.Postgres.Models.Alert model) => new() + { + AlertId = model.AlertId, + AlertTypeId = model.AlertTypeId, + Details = model.Details, + ExternalLink = model.ExternalLink, + StartDate = model.StartDate, + EndDate = model.EndDate + }; +} diff --git a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/ReferenceDataCache.cs b/TeachingRecordSystem/src/TeachingRecordSystem.Core/ReferenceDataCache.cs similarity index 72% rename from TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/ReferenceDataCache.cs rename to TeachingRecordSystem/src/TeachingRecordSystem.Core/ReferenceDataCache.cs index dd4fdfd47..668461910 100644 --- a/TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/ReferenceDataCache.cs +++ b/TeachingRecordSystem/src/TeachingRecordSystem.Core/ReferenceDataCache.cs @@ -1,10 +1,15 @@ +using TeachingRecordSystem.Core.DataStore.Postgres; +using TeachingRecordSystem.Core.DataStore.Postgres.Models; +using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Dqt.Queries; -namespace TeachingRecordSystem.Core.Dqt; +namespace TeachingRecordSystem.Core; -public class ReferenceDataCache : IStartupTask +public class ReferenceDataCache( + ICrmQueryDispatcher crmQueryDispatcher, + IDbContextFactory dbContextFactory) : IStartupTask { - private readonly ICrmQueryDispatcher _crmQueryDispatcher; + // CRM private Task? _mqEstablishmentsTask; private Task? _getSanctionCodesTask; private Task? _getSubjectsTask; @@ -14,10 +19,9 @@ public class ReferenceDataCache : IStartupTask private Task? _getHeQualificationsTask; private Task? _getHeSubjectsTask; - public ReferenceDataCache(ICrmQueryDispatcher crmQueryDispatcher) - { - _crmQueryDispatcher = crmQueryDispatcher; - } + // TRS + private Task? _alertCategoriesTask; + private Task? _alertTypesTask; public async Task GetSanctionCodeByValue(string value) { @@ -144,48 +148,91 @@ public async Task GetHeSubjectByValue(string value) return heSubjects.First(s => s.dfeta_Value == value, $"Could not find HE subject with value: '{value}'."); } + public async Task GetAlertCategories() + { + var alertCategories = await EnsureAlertCategories(); + return alertCategories; + } + + public async Task GetAlertCategoryById(Guid alertCategoryId) + { + var alertCategories = await EnsureAlertCategories(); + return alertCategories.Single(ac => ac.AlertCategoryId == alertCategoryId, $"Could not find alert category with ID: '{alertCategoryId}'."); + } + + public async Task GetAlertTypeById(Guid alertTypeId) + { + var alertTypes = await EnsureAlertTypes(); + return alertTypes.Single(at => at.AlertTypeId == alertTypeId, $"Could not find alert type with ID: '{alertTypeId}'."); + } + + public async Task GetAlertTypes() + { + var alertTypes = await EnsureAlertTypes(); + return alertTypes; + } + private Task EnsureSanctionCodes() => LazyInitializer.EnsureInitialized( ref _getSanctionCodesTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllActiveSanctionCodesQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllActiveSanctionCodesQuery())); private Task EnsureSubjects() => LazyInitializer.EnsureInitialized( ref _getSubjectsTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllSubjectsQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllSubjectsQuery())); private Task EnsureTeacherStatuses() => LazyInitializer.EnsureInitialized( ref _getTeacherStatusesTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllTeacherStatusesQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllTeacherStatusesQuery())); private Task EnsureEarlyYearsStatuses() => LazyInitializer.EnsureInitialized( ref _getEarlyYearsStatusesTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllActiveEarlyYearsStatusesQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllActiveEarlyYearsStatusesQuery())); private Task EnsureSpecialisms() => LazyInitializer.EnsureInitialized( ref _getSpecialismsTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllSpecialismsQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllSpecialismsQuery())); private Task EnsureMqEstablishments() => LazyInitializer.EnsureInitialized( ref _mqEstablishmentsTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllMqEstablishmentsQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllMqEstablishmentsQuery())); private Task EnsureHeQualifications() => LazyInitializer.EnsureInitialized( ref _getHeQualificationsTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllActiveHeQualificationsQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllActiveHeQualificationsQuery())); private Task EnsureHeSubjects() => LazyInitializer.EnsureInitialized( ref _getHeSubjectsTask, - () => _crmQueryDispatcher.ExecuteQuery(new GetAllActiveHeSubjectsQuery())); + () => crmQueryDispatcher.ExecuteQuery(new GetAllActiveHeSubjectsQuery())); + + private Task EnsureAlertCategories() => + LazyInitializer.EnsureInitialized( + ref _alertCategoriesTask, + () => + { + using var dbContext = dbContextFactory.CreateDbContext(); + return dbContext.AlertCategories.ToArrayAsync(); + }); + + private Task EnsureAlertTypes() => + LazyInitializer.EnsureInitialized( + ref _alertTypesTask, + () => + { + using var dbContext = dbContextFactory.CreateDbContext(); + return dbContext.AlertTypes.ToArrayAsync(); + }); async Task IStartupTask.Execute() { + // CRM await EnsureSanctionCodes(); await EnsureSubjects(); await EnsureTeacherStatuses(); @@ -194,5 +241,9 @@ async Task IStartupTask.Execute() await EnsureMqEstablishments(); await EnsureHeQualifications(); await EnsureHeSubjects(); + + // TRS + await EnsureAlertCategories(); + await EnsureAlertTypes(); } } diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests/CrmClientFixture.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests/CrmClientFixture.cs index 2b1d0f98f..6f85c1faf 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests/CrmClientFixture.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Dqt.CrmIntegrationTests/CrmClientFixture.cs @@ -33,8 +33,8 @@ public CrmClientFixture(ServiceClient serviceClient, DbFixture dbFixture, IConfi _memoryCache = memoryCache; _trnGenerationApiClient = GetTrnGenerationApiClient(); _referenceDataCache = new ReferenceDataCache( - new CrmQueryDispatcher(CreateQueryServiceProvider(_baseServiceClient, referenceDataCache: null), - serviceClientName: null)); + new CrmQueryDispatcher(CreateQueryServiceProvider(_baseServiceClient, referenceDataCache: null), serviceClientName: null), + dbFixture.GetDbContextFactory()); } public IClock Clock { get; } diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Gias/EstablishmentRefresherTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Gias/EstablishmentRefresherTests.cs index ed2187120..6b53bd4d6 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Gias/EstablishmentRefresherTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Gias/EstablishmentRefresherTests.cs @@ -1,5 +1,4 @@ using Microsoft.PowerPlatform.Dataverse.Client; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.Establishments.Gias; using TeachingRecordSystem.Core.Services.TrsDataSync; using Establishment = TeachingRecordSystem.Core.Models.Establishment; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Tps/TpsEstablishmentRefresherTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Tps/TpsEstablishmentRefresherTests.cs index 3d72f6a25..17b6abbdc 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Tps/TpsEstablishmentRefresherTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/Establishments/Tps/TpsEstablishmentRefresherTests.cs @@ -1,7 +1,6 @@ using System.Text; using Microsoft.PowerPlatform.Dataverse.Client; using TeachingRecordSystem.Core.DataStore.Postgres.Models; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.Establishments.Tps; using TeachingRecordSystem.Core.Services.TrsDataSync; using TeachingRecordSystem.Core.Services.WorkforceData; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/PersonMatching/PersonMatchingServiceTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/PersonMatching/PersonMatchingServiceTests.cs index 6293cedd7..b3c701c15 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/PersonMatching/PersonMatchingServiceTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/PersonMatching/PersonMatchingServiceTests.cs @@ -1,6 +1,5 @@ using Microsoft.PowerPlatform.Dataverse.Client; using TeachingRecordSystem.Core.DataStore.Postgres.Models; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.PersonMatching; using TeachingRecordSystem.Core.Services.TrsDataSync; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncHelperTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncHelperTests.cs index ac59cf803..58badfcb9 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncHelperTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncHelperTests.cs @@ -1,5 +1,4 @@ using Microsoft.PowerPlatform.Dataverse.Client; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.TrsDataSync; namespace TeachingRecordSystem.Core.Tests.Services.TrsDataSync; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncServiceFixture.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncServiceFixture.cs index 2fef24af9..cff5cc1a4 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncServiceFixture.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/TrsDataSync/TrsDataSyncServiceFixture.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Options; using Microsoft.PowerPlatform.Dataverse.Client; using Microsoft.Xrm.Sdk; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.TrsDataSync; namespace TeachingRecordSystem.Core.Tests.Services.TrsDataSync; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/TpsCsvExtractProcessorTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/TpsCsvExtractProcessorTests.cs index 17d2a3d11..878e83c5f 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/TpsCsvExtractProcessorTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/TpsCsvExtractProcessorTests.cs @@ -1,6 +1,5 @@ using Microsoft.PowerPlatform.Dataverse.Client; using TeachingRecordSystem.Core.DataStore.Postgres.Models; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.TrsDataSync; using TeachingRecordSystem.Core.Services.WorkforceData; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/WorkforceDataExporterTests.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/WorkforceDataExporterTests.cs index 0f4399694..50c189df2 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/WorkforceDataExporterTests.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.Core.Tests/Services/WorkforceData/WorkforceDataExporterTests.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.Options; using Microsoft.PowerPlatform.Dataverse.Client; using Parquet.Serialization; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Services.TrsDataSync; using TeachingRecordSystem.Core.Services.WorkforceData; using TeachingRecordSystem.Core.Services.WorkforceData.Google; diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.CreatePerson.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.CreatePerson.cs index d18a3c4b6..10a19872d 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.CreatePerson.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.CreatePerson.cs @@ -35,6 +35,7 @@ public class CreatePersonBuilder private readonly List _qualifications = new(); private readonly List _qtsRegistrations = new(); private readonly List _sanctions = []; + private readonly List _alertBuilders = []; private readonly List _mqBuilders = []; private DateOnly? _qtlsDate; private readonly List _inductions = []; @@ -159,6 +160,14 @@ public CreatePersonBuilder WithSanction( return this; } + public CreatePersonBuilder WithAlert(Action? configure = null) + { + var alertBuilder = new CreatePersonAlertBuilder(); + configure?.Invoke(alertBuilder); + _alertBuilders.Add(alertBuilder); + return this; + } + public CreatePersonBuilder WithQualification( Guid? qualificationId, dfeta_qualification_dfeta_Type type, @@ -585,6 +594,7 @@ await testData.SyncConfiguration.SyncIfEnabled( _syncEnabledOverride); var mqs = await Task.WhenAll(_mqBuilders.Select(mqb => mqb.Execute(this, testData))); + var alerts = await Task.WhenAll(_alertBuilders.Select(ab => ab.Execute(this, testData))); return new CreatePersonResult() { @@ -607,11 +617,128 @@ await testData.SyncConfiguration.SyncIfEnabled( Sanctions = [.. _sanctions], MandatoryQualifications = mqs, Inductions = [.. _inductions], - InductionPeriods = [.. _inductionPeriods] + InductionPeriods = [.. _inductionPeriods], + Alerts = alerts }; } } + public class CreatePersonAlertBuilder + { + private Option _alertTypeId; + private Option _details; + private Option _externalLink; + private Option _startDate; + private Option _endDate; + private Option _createdByUser; + private Option _createdUtc; + + public Guid AlertId { get; } = Guid.NewGuid(); + + public CreatePersonAlertBuilder WithAlertTypeId(Guid? alertTypeId) + { + _alertTypeId = Option.Some(alertTypeId); + return this; + } + + public CreatePersonAlertBuilder WithDetails(string? details) + { + _details = Option.Some(details); + return this; + } + + public CreatePersonAlertBuilder WithExternalLink(string? externalLink) + { + _externalLink = Option.Some(externalLink); + return this; + } + + public CreatePersonAlertBuilder WithStartDate(DateOnly? startDate) + { + _startDate = Option.Some(startDate); + return this; + } + + public CreatePersonAlertBuilder WithEndDate(DateOnly? endDate) + { + if (endDate.HasValue && !_startDate.HasValue) + { + throw new ArgumentException($"{nameof(endDate)} cannot be specified until {nameof(WithStartDate)} has been called with a non null startDate."); + } + + if (endDate.HasValue && endDate < _startDate.ValueOrDefault()) + { + throw new ArgumentException($"{nameof(endDate)} must be after startDate specified in {nameof(WithStartDate)}."); + } + + _endDate = Option.Some(endDate); + return this; + } + + public CreatePersonAlertBuilder WithCreatedUtc(DateTime? createdUtc) + { + _createdUtc = Option.Some(createdUtc); + return this; + } + + public CreatePersonAlertBuilder WithCreatedByUser(EventModels.RaisedByUserInfo user) + { + _createdByUser = Option.Some(user); + return this; + } + + internal async Task Execute(CreatePersonBuilder createPersonBuilder, TestData testData) + { + var personId = createPersonBuilder.PersonId; + + if (_alertTypeId.HasValue && !(await testData.ReferenceDataCache.GetAlertTypes()).Any(a => a.AlertTypeId == _alertTypeId.ValueOrDefault())) + { + throw new ArgumentException("AlertTypeId is invalid."); + } + + var alertTypeId = _alertTypeId.ValueOr((await testData.ReferenceDataCache.GetAlertTypes()).RandomOne().AlertTypeId); + var details = _details.ValueOr(testData.GenerateLoremIpsum()); + var externalLink = _externalLink.ValueOr(testData.GenerateUrl()); + var startDate = _startDate.ValueOr(testData.GenerateDate(min: new DateOnly(2000, 1, 1))); + var endDate = _endDate.ValueOr((DateOnly?)null); + var createdByUser = _createdByUser.ValueOr(EventModels.RaisedByUserInfo.FromUserId(Core.DataStore.Postgres.Models.SystemUser.SystemUserId)); + var createdUtc = _createdUtc.ValueOr(testData.Clock.UtcNow); + + return await testData.WithDbContext(async dbContext => + { + var alert = new Alert() + { + AlertId = AlertId, + PersonId = personId, + AlertTypeId = alertTypeId!.Value, + Details = details, + ExternalLink = externalLink, + StartDate = startDate, + EndDate = endDate, + CreatedOn = createdUtc!.Value, + UpdatedOn = createdUtc!.Value + }; + + dbContext.Alerts.Add(alert); + + var createdEvent = new AlertCreatedEvent() + { + EventId = Guid.NewGuid(), + CreatedUtc = createdUtc!.Value, + RaisedBy = createdByUser, + Alert = TeachingRecordSystem.Core.Events.Models.Alert.FromModel(alert), + PersonId = personId + }; + + dbContext.AddEvent(createdEvent); + + await dbContext.SaveChangesAsync(); + + return alert; + }); + } + } + public class CreatePersonMandatoryQualificationBuilder { private Option _mandatoryQualificationProviderId; @@ -836,9 +963,11 @@ public record CreatePersonResult public required IReadOnlyCollection MandatoryQualifications { get; init; } public required IReadOnlyCollection Inductions { get; init; } public required IReadOnlyCollection InductionPeriods { get; init; } + public required IReadOnlyCollection Alerts { get; init; } } public record Induction(Guid InductionId, dfeta_InductionStatus inductionStatus, dfeta_InductionExemptionReason? inductionExemptionReason, DateOnly? StartDate, DateOnly? CompletetionDate); + public record InductionPeriod(Guid InductionId, DateOnly? startDate, DateOnly? endDate, Guid AppropriateBodyOrgId); public record Sanction(Guid SanctionId, string SanctionCode, DateOnly? StartDate, DateOnly? EndDate, DateOnly? ReviewDate, bool Spent, string? Details, string? DetailsLink, bool IsActive); diff --git a/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.cs b/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.cs index e8e073f3c..b4fe32f3e 100644 --- a/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.cs +++ b/TeachingRecordSystem/tests/TeachingRecordSystem.TestCommon/TestData.cs @@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.PowerPlatform.Dataverse.Client; using TeachingRecordSystem.Core.DataStore.Postgres; -using TeachingRecordSystem.Core.Dqt; using TeachingRecordSystem.Core.Dqt.Models; using TeachingRecordSystem.Core.Services.TrsDataSync; @@ -258,6 +257,10 @@ public DateOnly GenerateChangedDate(DateOnly currentDate, DateOnly min, DateOnly public string GenerateNationalInsuranceNumber() => Faker.Identification.UkNationalInsuranceNumber(); + public string GenerateLoremIpsum() => Faker.Lorem.Paragraph(); + + public string GenerateUrl() => Faker.Internet.Url(); + protected async Task WithDbContext(Func> action) { using var dbContext = await DbContextFactory.CreateDbContextAsync();