From 856160d54a4c174fabd32e11ba83cde641221bef Mon Sep 17 00:00:00 2001 From: Zach Hodges Date: Fri, 29 Nov 2024 18:17:43 +0000 Subject: [PATCH 1/5] wip --- .../Dfe.Complete.Api.Client.csproj | 1 + src/Dfe.Complete.Domain/Entities/Project.cs | 40 +++++++------- .../Controllers/ProjectsControllerTests.cs | 25 +++++++++ ...teConversionProjectCommandCustomization.cs | 52 +++++++++++++++++++ ...pplicationDbContextFactoryCustomization.cs | 16 +++--- 5 files changed, 107 insertions(+), 27 deletions(-) create mode 100644 src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs create mode 100644 src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs diff --git a/src/Dfe.Complete.Api.Client/Dfe.Complete.Api.Client.csproj b/src/Dfe.Complete.Api.Client/Dfe.Complete.Api.Client.csproj index d051b00..e329751 100644 --- a/src/Dfe.Complete.Api.Client/Dfe.Complete.Api.Client.csproj +++ b/src/Dfe.Complete.Api.Client/Dfe.Complete.Api.Client.csproj @@ -9,6 +9,7 @@ API Client The API description. DFE-Digital + 9d380f80-743c-4d55-bfb8-0b7b366bb5ab diff --git a/src/Dfe.Complete.Domain/Entities/Project.cs b/src/Dfe.Complete.Domain/Entities/Project.cs index 2392ffd..b3bbffb 100644 --- a/src/Dfe.Complete.Domain/Entities/Project.cs +++ b/src/Dfe.Complete.Domain/Entities/Project.cs @@ -92,7 +92,9 @@ public class Project : BaseAggregateRoot, IEntity public virtual User? RegionalDeliveryOfficer { get; set; } - private Project() { } + private Project() + { + } public Project( Urn urn, @@ -111,7 +113,7 @@ public Project( string advisoryBoardConditions, string establishmentSharepointLink, string incomingTrustSharepointLink - ) + ) { Urn = urn ?? throw new ArgumentNullException(nameof(urn)); CreatedAt = createdAt != default ? createdAt : throw new ArgumentNullException(nameof(createdAt)); @@ -150,27 +152,25 @@ public static Project Create(Urn urn, string incomingTrustSharepointLink) { var project = new Project(urn, - createdAt, - updatedAt, - taskType, - projectType, - tasksDataId, - significantDate, - isSignificantDateProvisional, - incomingTrustUkprn, - region, - isDueTo2RI, - hasAcademyOrderBeenIssued, - advisoryBoardDate, - advisoryBoardConditions, - establishmentSharepointLink, - incomingTrustSharepointLink); + createdAt, + updatedAt, + taskType, + projectType, + tasksDataId, + significantDate, + isSignificantDateProvisional, + incomingTrustUkprn, + region, + isDueTo2RI, + hasAcademyOrderBeenIssued, + advisoryBoardDate, + advisoryBoardConditions, + establishmentSharepointLink, + incomingTrustSharepointLink); project.AddDomainEvent(new ProjectCreatedEvent(project)); return project; } - - -} +} \ No newline at end of file diff --git a/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs new file mode 100644 index 0000000..102bc55 --- /dev/null +++ b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs @@ -0,0 +1,25 @@ +using Dfe.Complete.Client.Contracts; +using Dfe.Complete.Tests.Common.Customizations; +using Dfe.Complete.Tests.Common.Customizations.Commands; +using DfE.CoreLibs.Testing.AutoFixture.Attributes; +using DfE.CoreLibs.Testing.Mocks.WebApplicationFactory; + +namespace Dfe.Complete.Api.Tests.Integration.Controllers; + +public class ProjectsControllerTests +{ + [Theory] + [CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization), typeof(CreateConversionProjectCommandCustomization))] + public async Task CreateProject_Async_ShouldCreateConversionProject(CustomWebApplicationDbContextFactory factory, + CreateConversionProjectCommand createConversionProjectCommand, + ICreateProjectClient createProjectClient) + { + //todo: does this ned to be re-added on the controller? + // factory.TestClaims = [new Claim(ClaimTypes.Role, "API.Write")]; + + var result = await createProjectClient.Projects_CreateProject_Async(createConversionProjectCommand); + + Assert.NotNull(result); + Assert.IsType(result.Value); + } +} \ No newline at end of file diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs new file mode 100644 index 0000000..9560132 --- /dev/null +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs @@ -0,0 +1,52 @@ +using AutoFixture; +using Dfe.Complete.Application.Projects.Commands.CreateProject; +using Dfe.Complete.Domain.ValueObjects; +using Dfe.Complete.Domain.Enums; + +namespace Dfe.Complete.Tests.Common.Customizations.Commands +{ + public class CreateConversionProjectCommandCustomization : ICustomization + { + public void Customize(IFixture fixture) + { + fixture.Customize(composer => composer.FromFactory(() => + { + var urn = fixture.Create(); + var createdAt = fixture.Create().ToUniversalTime(); + var updatedAt = createdAt.AddMinutes(fixture.Create() % 100); + var taskType = fixture.Create(); + var projectType = fixture.Create(); + var tasksDataId = fixture.Create(); + var significantDate = fixture.Create(); + var isSignificantDateProvisional = fixture.Create(); + var incomingTrustUkprn = new Ukprn(fixture.Create()); + var region = fixture.Create(); + var isDueTo2Ri = fixture.Create(); + var hasAcademyOrderBeenIssued = fixture.Create(); + var advisoryBoardDate = fixture.Create(); + var advisoryBoardConditions = fixture.Create(); + var establishmentSharepointLink = fixture.Create().ToString(); + var incomingTrustSharepointLink = fixture.Create().ToString(); + + return new CreateConversionProjectCommand( + new Urn(urn), + createdAt, + updatedAt, + taskType, + projectType, + tasksDataId, + significantDate, + isSignificantDateProvisional, + incomingTrustUkprn, + region, + isDueTo2Ri, + hasAcademyOrderBeenIssued, + advisoryBoardDate, + advisoryBoardConditions, + establishmentSharepointLink, + incomingTrustSharepointLink + ); + })); + } + } +} diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs index b59c0d2..ff709b4 100644 --- a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs @@ -25,10 +25,10 @@ public void Customize(IFixture fixture) var factory = new CustomWebApplicationDbContextFactory() { - SeedData = new Dictionary> - { - { typeof(SclContext), context => SclContextSeeder.Seed((SclContext)context) }, - }, + // SeedData = new Dictionary> + // { + // { typeof(SclContext), context => SclContextSeeder.Seed((SclContext)context) }, + // }, ExternalServicesConfiguration = services => { services.PostConfigure(options => @@ -57,14 +57,16 @@ public void Customize(IFixture fixture) var services = new ServiceCollection(); services.AddSingleton(config); - services.AddCompleteApiClient(config, client); - + // services.AddCompleteApiClient(config, client); + services.AddCompleteApiClient(config, client); + var serviceProvider = services.BuildServiceProvider(); fixture.Inject(factory); fixture.Inject(serviceProvider); fixture.Inject(client); - fixture.Inject(serviceProvider.GetRequiredService()); + // fixture.Inject(serviceProvider.GetRequiredService()); + fixture.Inject(serviceProvider.GetRequiredService()); fixture.Inject(new List()); return factory; From 92c37f01f1a6e86598a2826ebcf424abb0318d27 Mon Sep 17 00:00:00 2001 From: Zach Hodges Date: Tue, 3 Dec 2024 16:13:52 +0000 Subject: [PATCH 2/5] wip --- .../Extensions/ServiceCollectionExtensions.cs | 4 +++- src/Dfe.Complete.Api/Program.cs | 3 +-- .../Projects/Commands/CreateProject/CreateProject.cs | 5 ++--- .../Projects/EventHandlers/ProjectCreatedEventHandler.cs | 6 ++++++ .../InfrastructureServiceCollectionExtensions.cs | 9 +++------ .../CustomWebApplicationDbContextFactoryCustomization.cs | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 src/Dfe.Complete.Application/Projects/EventHandlers/ProjectCreatedEventHandler.cs diff --git a/src/Dfe.Complete.Api.Client/Extensions/ServiceCollectionExtensions.cs b/src/Dfe.Complete.Api.Client/Extensions/ServiceCollectionExtensions.cs index 9722517..6e9c596 100644 --- a/src/Dfe.Complete.Api.Client/Extensions/ServiceCollectionExtensions.cs +++ b/src/Dfe.Complete.Api.Client/Extensions/ServiceCollectionExtensions.cs @@ -16,7 +16,8 @@ public static IServiceCollection AddCompleteApiClient { loggerConfiguration diff --git a/src/Dfe.Complete.Application/Projects/Commands/CreateProject/CreateProject.cs b/src/Dfe.Complete.Application/Projects/Commands/CreateProject/CreateProject.cs index f8f4b5a..fcb6970 100644 --- a/src/Dfe.Complete.Application/Projects/Commands/CreateProject/CreateProject.cs +++ b/src/Dfe.Complete.Application/Projects/Commands/CreateProject/CreateProject.cs @@ -23,8 +23,7 @@ public record CreateConversionProjectCommand( string AdvisoryBoardConditions, string EstablishmentSharepointLink, string IncomingTrustSharepointLink) : IRequest; - - + public class CreateConversionProjectCommandHandler(ICompleteRepository projectRepository, ICompleteRepository conversionTaskRepository) : IRequestHandler { @@ -51,7 +50,7 @@ public async Task Handle(CreateConversionProjectCommand request, Canc request.AdvisoryBoardConditions, request.EstablishmentSharepointLink, request.IncomingTrustSharepointLink); - + await conversionTaskRepository.AddAsync(conversionTask, cancellationToken); await projectRepository.AddAsync(project, cancellationToken); diff --git a/src/Dfe.Complete.Application/Projects/EventHandlers/ProjectCreatedEventHandler.cs b/src/Dfe.Complete.Application/Projects/EventHandlers/ProjectCreatedEventHandler.cs new file mode 100644 index 0000000..005cce1 --- /dev/null +++ b/src/Dfe.Complete.Application/Projects/EventHandlers/ProjectCreatedEventHandler.cs @@ -0,0 +1,6 @@ +namespace Microsoft.Extensions.DependencyInjection.Projects.EventHandlers; + +public class ProjectCreatedEventHandler +{ + +} \ No newline at end of file diff --git a/src/Dfe.Complete.Infrastructure/InfrastructureServiceCollectionExtensions.cs b/src/Dfe.Complete.Infrastructure/InfrastructureServiceCollectionExtensions.cs index 7fdac2c..c77c40d 100644 --- a/src/Dfe.Complete.Infrastructure/InfrastructureServiceCollectionExtensions.cs +++ b/src/Dfe.Complete.Infrastructure/InfrastructureServiceCollectionExtensions.cs @@ -23,11 +23,8 @@ public static IServiceCollection AddInfrastructureDependencyGroup( //Db var connectionString = config.GetConnectionString("DefaultConnection"); - services.AddDbContext(options => - options.UseSqlServer(connectionString)); - - services.AddDbContext(options => - options.UseSqlServer(connectionString)); + services.AddDbContext(options => options.UseSqlServer(connectionString)); + services.AddDbContext(options => options.UseSqlServer(connectionString)); // Authentication services.AddCustomAuthorization(config); @@ -35,4 +32,4 @@ public static IServiceCollection AddInfrastructureDependencyGroup( return services; } } -} +} \ No newline at end of file diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs index ff709b4..cd1287f 100644 --- a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs @@ -51,7 +51,7 @@ public void Customize(IFixture fixture) var config = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary { - { "ApiClient:BaseUrl", client.BaseAddress!.ToString() } + { "CompleteApiClient:BaseUrl", client.BaseAddress!.ToString() } }) .Build(); From 9e241241f551a04a517381750b5cfc92b7e5b9a3 Mon Sep 17 00:00:00 2001 From: Zach Hodges Date: Thu, 5 Dec 2024 10:53:04 +0000 Subject: [PATCH 3/5] Create conversion project integration test now working --- .../Controllers/SchoolsController.cs | 2 +- .../Commands/CreateSchool/CreateSchool.cs | 3 +-- .../Database/CompleteContext.cs | 3 +-- .../Controllers/ProjectsControllerTests.cs | 10 ++++---- ...pplicationDbContextFactoryCustomization.cs | 24 ++++++++++--------- ...ustomWebApplicationFactoryCustomization.cs | 6 ++--- .../Seeders/CompleteContextSeeder.cs | 6 +++++ 7 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 src/Tests/Dfe.Complete.Tests.Common/Seeders/CompleteContextSeeder.cs diff --git a/src/Dfe.Complete.Api/Controllers/SchoolsController.cs b/src/Dfe.Complete.Api/Controllers/SchoolsController.cs index fa33e06..04b7928 100644 --- a/src/Dfe.Complete.Api/Controllers/SchoolsController.cs +++ b/src/Dfe.Complete.Api/Controllers/SchoolsController.cs @@ -57,7 +57,7 @@ public async Task GetPrincipalsBySchoolsAsync([FromBody] GetPrinc /// /// The request. /// The cancellation token. - [Authorize(Policy = "API.Write")] + // [Authorize(Policy = "API.Write")] [HttpPost] [SwaggerResponse(201, "School created successfully.", typeof(SchoolId))] [SwaggerResponse(400, "Invalid request data.")] diff --git a/src/Dfe.Complete.Application/Schools/Commands/CreateSchool/CreateSchool.cs b/src/Dfe.Complete.Application/Schools/Commands/CreateSchool/CreateSchool.cs index cbeb1b8..9a74a53 100644 --- a/src/Dfe.Complete.Application/Schools/Commands/CreateSchool/CreateSchool.cs +++ b/src/Dfe.Complete.Application/Schools/Commands/CreateSchool/CreateSchool.cs @@ -14,8 +14,7 @@ public record CreateSchoolCommand( PrincipalDetailsModel PrincipalDetails ) : IRequest; - public class CreateSchoolCommandHandler(ISclRepository schoolRepository) - : IRequestHandler + public class CreateSchoolCommandHandler(ISclRepository schoolRepository) : IRequestHandler { public async Task Handle(CreateSchoolCommand request, CancellationToken cancellationToken) { diff --git a/src/Dfe.Complete.Infrastructure/Database/CompleteContext.cs b/src/Dfe.Complete.Infrastructure/Database/CompleteContext.cs index 2f76abe..b6ae224 100644 --- a/src/Dfe.Complete.Infrastructure/Database/CompleteContext.cs +++ b/src/Dfe.Complete.Infrastructure/Database/CompleteContext.cs @@ -27,8 +27,7 @@ public CompleteContext(DbContextOptions options, IConfiguration _configuration = configuration; _serviceProvider = serviceProvider; } - - + public virtual DbSet Contacts { get; set; } public virtual DbSet ConversionTasksData { get; set; } diff --git a/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs index 102bc55..8dd4d47 100644 --- a/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs +++ b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs @@ -9,17 +9,19 @@ namespace Dfe.Complete.Api.Tests.Integration.Controllers; public class ProjectsControllerTests { [Theory] - [CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization), typeof(CreateConversionProjectCommandCustomization))] - public async Task CreateProject_Async_ShouldCreateConversionProject(CustomWebApplicationDbContextFactory factory, + [CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization), + typeof(CreateConversionProjectCommandCustomization))] + public async Task CreateProject_Async_ShouldCreateConversionProject( + CustomWebApplicationDbContextFactory factory, CreateConversionProjectCommand createConversionProjectCommand, ICreateProjectClient createProjectClient) { - //todo: does this ned to be re-added on the controller? + //todo: when auth is done, add this back in // factory.TestClaims = [new Claim(ClaimTypes.Role, "API.Write")]; var result = await createProjectClient.Projects_CreateProject_Async(createConversionProjectCommand); Assert.NotNull(result); - Assert.IsType(result.Value); + Assert.IsType(result); } } \ No newline at end of file diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs index cd1287f..4d2d35f 100644 --- a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationDbContextFactoryCustomization.cs @@ -5,14 +5,14 @@ using Dfe.Complete.Api.Client.Extensions; using Dfe.Complete.Client; using Dfe.Complete.Client.Contracts; -using Dfe.Complete.Infrastructure.Database; -using Dfe.Complete.Tests.Common.Seeders; using Microsoft.AspNetCore.Authentication; -using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using System.Net.Http.Headers; using System.Security.Claims; +using Dfe.Complete.Infrastructure.Database; +using Dfe.Complete.Tests.Common.Seeders; +using Microsoft.EntityFrameworkCore; namespace Dfe.Complete.Tests.Common.Customizations { @@ -22,13 +22,15 @@ public void Customize(IFixture fixture) { fixture.Customize>(composer => composer.FromFactory(() => { - var factory = new CustomWebApplicationDbContextFactory() { - // SeedData = new Dictionary> - // { - // { typeof(SclContext), context => SclContextSeeder.Seed((SclContext)context) }, - // }, + //TODO: when needed, seed data for CompleteContext + SeedData = new Dictionary> + { + //TODO: add this but for CompleteContext when needed: + //typeof(CompleteContext), context => CompleteContextSeeder.Seed((CompleteContext)context) + { typeof(CompleteContext), context => {} }, + }, ExternalServicesConfiguration = services => { services.PostConfigure(options => @@ -57,16 +59,16 @@ public void Customize(IFixture fixture) var services = new ServiceCollection(); services.AddSingleton(config); - // services.AddCompleteApiClient(config, client); + services.AddCompleteApiClient(config, client); var serviceProvider = services.BuildServiceProvider(); - + fixture.Inject(factory); fixture.Inject(serviceProvider); fixture.Inject(client); - // fixture.Inject(serviceProvider.GetRequiredService()); fixture.Inject(serviceProvider.GetRequiredService()); + fixture.Inject(new List()); return factory; diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationFactoryCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationFactoryCustomization.cs index 9a3303d..58c1ca3 100644 --- a/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationFactoryCustomization.cs +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/CustomWebApplicationFactoryCustomization.cs @@ -19,7 +19,6 @@ public void Customize(IFixture fixture) { fixture.Customize>(composer => composer.FromFactory(() => { - var factory = new CustomWebApplicationFactory() { ExternalServicesConfiguration = services => @@ -31,12 +30,11 @@ public void Customize(IFixture fixture) }); services.AddAuthentication("TestScheme") - .AddScheme("TestScheme", options => { }); + .AddScheme("TestScheme", _ => { }); }, ExternalHttpClientConfiguration = client => { - client.DefaultRequestHeaders.Authorization = - new AuthenticationHeaderValue("Bearer", "external-mock-token"); + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "external-mock-token"); } }; diff --git a/src/Tests/Dfe.Complete.Tests.Common/Seeders/CompleteContextSeeder.cs b/src/Tests/Dfe.Complete.Tests.Common/Seeders/CompleteContextSeeder.cs new file mode 100644 index 0000000..90dcb10 --- /dev/null +++ b/src/Tests/Dfe.Complete.Tests.Common/Seeders/CompleteContextSeeder.cs @@ -0,0 +1,6 @@ +namespace Dfe.Complete.Tests.Common.Seeders; + +public class CompleteContextSeeder +{ + //TODO: implement when needed +} \ No newline at end of file From e20255d2e62d559786bcddd67100c554126a18a0 Mon Sep 17 00:00:00 2001 From: Zach Hodges Date: Fri, 6 Dec 2024 16:56:00 +0000 Subject: [PATCH 4/5] exception test --- .../Controllers/ProjectsControllerTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs index 8dd4d47..79d95d4 100644 --- a/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs +++ b/src/Tests/Dfe.Complete.Api.Tests.Integration/Controllers/ProjectsControllerTests.cs @@ -1,3 +1,4 @@ +using System.Net; using Dfe.Complete.Client.Contracts; using Dfe.Complete.Tests.Common.Customizations; using Dfe.Complete.Tests.Common.Customizations.Commands; @@ -24,4 +25,24 @@ public async Task CreateProject_Async_ShouldCreateConversionProject( Assert.NotNull(result); Assert.IsType(result); } + + [Theory] + [CustomAutoData(typeof(CustomWebApplicationDbContextFactoryCustomization))] + public async Task CreateProject_WithNullRequest_ThrowsException( + CustomWebApplicationDbContextFactory factory, + CreateConversionProjectCommand createConversionProjectCommand, + ICreateProjectClient createProjectClient) + { + //todo: when auth is done, add this back in + // factory.TestClaims = [new Claim(ClaimTypes.Role, "API.Write")]; + + createConversionProjectCommand.Urn = null; + + + //todo: change exception type? + var exception = await Assert.ThrowsAsync(async () => + await createProjectClient.Projects_CreateProject_Async(createConversionProjectCommand)); + + Assert.Equal(HttpStatusCode.BadRequest, (HttpStatusCode)exception.StatusCode); + } } \ No newline at end of file From 54e1327665939243d7308a17ce89f430ef75a66b Mon Sep 17 00:00:00 2001 From: Zach Hodges Date: Tue, 17 Dec 2024 14:55:19 +0000 Subject: [PATCH 5/5] updated fixture --- ...reateConversionProjectCommandCustomization.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs b/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs index 9560132..375589e 100644 --- a/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs +++ b/src/Tests/Dfe.Complete.Tests.Common/Customizations/Commands/CreateConversionProjectCommandCustomization.cs @@ -11,12 +11,7 @@ public void Customize(IFixture fixture) { fixture.Customize(composer => composer.FromFactory(() => { - var urn = fixture.Create(); - var createdAt = fixture.Create().ToUniversalTime(); - var updatedAt = createdAt.AddMinutes(fixture.Create() % 100); - var taskType = fixture.Create(); - var projectType = fixture.Create(); - var tasksDataId = fixture.Create(); + var urn = new Urn(fixture.Create()); var significantDate = fixture.Create(); var isSignificantDateProvisional = fixture.Create(); var incomingTrustUkprn = new Ukprn(fixture.Create()); @@ -29,12 +24,7 @@ public void Customize(IFixture fixture) var incomingTrustSharepointLink = fixture.Create().ToString(); return new CreateConversionProjectCommand( - new Urn(urn), - createdAt, - updatedAt, - taskType, - projectType, - tasksDataId, + urn, significantDate, isSignificantDateProvisional, incomingTrustUkprn, @@ -49,4 +39,4 @@ public void Customize(IFixture fixture) })); } } -} +} \ No newline at end of file