From d38b0fbcd87f014af2489d5f5c4eb219ac291f5a Mon Sep 17 00:00:00 2001 From: Spencer O'HEGARTY Date: Wed, 24 Jul 2024 11:23:49 +0100 Subject: [PATCH 1/2] Added common code module project and moved across clean architecture and mappers from component library. --- Dfe.Data.SearchPrototype.sln | 14 +- .../Application/UseCase/IUseCase.cs | 32 +++++ .../Application/UseCase/IUseCaseRequest.cs | 8 ++ .../Dfe.Data.SearchPrototype.Common.csproj | 15 +++ .../Common/Mapper/IMapper.cs | 18 +++ .../TestDoubles/UseCaseRequestTestDoubles.cs | 14 ++ .../UseCase/TestDoubles/UseCaseTestDoubles.cs | 55 ++++++++ .../Application/UseCase/UseCaseTests.cs | 67 ++++++++++ ...e.Data.SearchPrototype.Common.Tests.csproj | 30 +++++ .../Dfe.Data.SearchPrototype.csproj | 7 + .../CognitiveSearchServiceAdapter.cs | 123 +++++++++--------- ...archResponseToEstablishmentResultMapper.cs | 3 +- .../AzureSearchResultToEstablishmentMapper.cs | 57 ++++---- .../SearchOptionsToAzureOptionsMapper.cs | 2 +- ...esponseToEstablishmentResultMapperTests.cs | 2 +- ...eSearchResultToEstablishmentMapperTests.cs | 4 +- .../ISearchServiceAdapter.cs | 35 +++-- .../ResultsToResponseMapper.cs | 4 +- .../SearchByKeywordUseCase.cs | 4 +- .../SearchForEstablishments/SearchContext.cs | 91 +++++++------ .../ResultsToResponseMapperTests.cs | 4 +- .../SearchByKeywordUseCaseTests.cs | 4 +- .../Web/Controllers/HomeController.cs | 4 +- .../Web/Dfe.Data.SearchPrototype.Web.csproj | 1 + ...earchByKeywordResponseToViewModelMapper.cs | 3 +- Dfe.Data.SearchPrototype/Web/Program.cs | 24 ++-- .../Unit/Controllers/HomeControllerTests.cs | 6 +- .../ServiceModelToViewModelMapperTests.cs | 4 +- .../SearchByKeywordUseCaseTestDouble.cs | 4 +- ...earchResultsToViewModelMapperTestDouble.cs | 4 +- 30 files changed, 447 insertions(+), 196 deletions(-) create mode 100644 Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCase.cs create mode 100644 Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCaseRequest.cs create mode 100644 Dfe.Data.SearchPrototype/Common/Dfe.Data.SearchPrototype.Common.csproj create mode 100644 Dfe.Data.SearchPrototype/Common/Mapper/IMapper.cs create mode 100644 Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseRequestTestDoubles.cs create mode 100644 Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseTestDoubles.cs create mode 100644 Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/UseCaseTests.cs create mode 100644 Dfe.Data.SearchPrototype/Common/Tests/Dfe.Data.SearchPrototype.Common.Tests.csproj diff --git a/Dfe.Data.SearchPrototype.sln b/Dfe.Data.SearchPrototype.sln index 82de0e1..2578518 100644 --- a/Dfe.Data.SearchPrototype.sln +++ b/Dfe.Data.SearchPrototype.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.We EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{0D4ACC06-9FA9-422A-8F92-92B565879E16}" ProjectSection(SolutionItems) = preProject - NuGet\DfE.Data.ComponentLibrary.CleanArchitecture.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.CleanArchitecture.2.0.37-beta-ci-20240610-104522.nupkg - NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping.2.0.37-beta-ci-20240610-104522.nupkg NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.2.0.37-beta-ci-20240610-104522.nupkg NuGet\DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg = NuGet\DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.2.0.37-beta-ci-20240610-104522.nupkg EndProjectSection @@ -23,6 +21,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Infrastructure.Tests", "Dfe.Data.SearchPrototype\Infrastructure\Tests\Dfe.Data.SearchPrototype.Infrastructure.Tests.csproj", "{62F6B827-75B0-43A6-9323-297F32016D71}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Common", "Dfe.Data.SearchPrototype\Common\Dfe.Data.SearchPrototype.Common.csproj", "{641005EB-1F41-466C-80C2-FA6F59572474}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Common.Tests", "Dfe.Data.SearchPrototype\Common\Tests\Dfe.Data.SearchPrototype.Common.Tests.csproj", "{78EF8B69-F1FB-461B-8872-18FA7F285305}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -53,6 +55,14 @@ Global {62F6B827-75B0-43A6-9323-297F32016D71}.Debug|Any CPU.Build.0 = Debug|Any CPU {62F6B827-75B0-43A6-9323-297F32016D71}.Release|Any CPU.ActiveCfg = Release|Any CPU {62F6B827-75B0-43A6-9323-297F32016D71}.Release|Any CPU.Build.0 = Release|Any CPU + {641005EB-1F41-466C-80C2-FA6F59572474}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {641005EB-1F41-466C-80C2-FA6F59572474}.Debug|Any CPU.Build.0 = Debug|Any CPU + {641005EB-1F41-466C-80C2-FA6F59572474}.Release|Any CPU.ActiveCfg = Release|Any CPU + {641005EB-1F41-466C-80C2-FA6F59572474}.Release|Any CPU.Build.0 = Release|Any CPU + {78EF8B69-F1FB-461B-8872-18FA7F285305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78EF8B69-F1FB-461B-8872-18FA7F285305}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78EF8B69-F1FB-461B-8872-18FA7F285305}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78EF8B69-F1FB-461B-8872-18FA7F285305}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCase.cs b/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCase.cs new file mode 100644 index 0000000..877a2e0 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCase.cs @@ -0,0 +1,32 @@ +namespace Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; + +/// +/// Contract which defines the behaviour for a use-case input port without any request params. +/// +/// The runtime type definition of the use-case response object. +public interface IUseCase +{ + /// + /// Async method to define how a use-case handles a given request + /// from an exterior source and the appropriate result returned. + /// + /// The runtime type definition of the use-case response. + Task HandleRequest(); +} + +/// +/// Implement when handling use-case requests when a request object (with parameters) is required. +/// +/// The type of request (input) passed to a given use case. +/// The type of response (output) passed back from the given use case. +public interface IUseCase +{ + /// + /// The invocation of the input-port handle that must be implemented by + /// a use-case that prescribes to the contract. The handle ensures that + /// the use-case-request object prescribed at run-time is correctly handled. + /// + /// The type of request passed to a given use case. + /// The type of request object to send to the input-port, defined at run-time. + Task HandleRequest(TUseCaseRequest request); +} diff --git a/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCaseRequest.cs b/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCaseRequest.cs new file mode 100644 index 0000000..5e37b90 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/CleanArchitecture/Application/UseCase/IUseCaseRequest.cs @@ -0,0 +1,8 @@ +namespace Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; + +/// +/// Contract which defines the response object to be associated with a use-case request. +/// +/// The runtime type definition of the use-case response object. +public interface IUseCaseRequest { +} \ No newline at end of file diff --git a/Dfe.Data.SearchPrototype/Common/Dfe.Data.SearchPrototype.Common.csproj b/Dfe.Data.SearchPrototype/Common/Dfe.Data.SearchPrototype.Common.csproj new file mode 100644 index 0000000..4a2de10 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Dfe.Data.SearchPrototype.Common.csproj @@ -0,0 +1,15 @@ + + + + net8.0 + enable + enable + + + + + + + + + diff --git a/Dfe.Data.SearchPrototype/Common/Mapper/IMapper.cs b/Dfe.Data.SearchPrototype/Common/Mapper/IMapper.cs new file mode 100644 index 0000000..a9f8ffd --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Mapper/IMapper.cs @@ -0,0 +1,18 @@ +namespace Dfe.Data.SearchPrototype.Common.Mappers; + +/// +/// +/// +/// +/// +public interface IMapper +{ + /// + /// + /// + /// + /// + /// + /// + TMapTo MapFrom(TMapFrom input); +} diff --git a/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseRequestTestDoubles.cs b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseRequestTestDoubles.cs new file mode 100644 index 0000000..d360cd3 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseRequestTestDoubles.cs @@ -0,0 +1,14 @@ +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Moq; + +namespace Dfe.Data.SearchPrototype.Common.Tests.CleanArchitecture.Application.UseCase.TestDoubles; + +public static class UseCaseRequestTestDoubles +{ + public static Mock> UseCaseRequestMock< + TUseCaseReponse>() => new(); + + public static IUseCaseRequest MockUseCaseRequest< + TUseCaseReponse>() => + UseCaseRequestMock().Object; +} diff --git a/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseTestDoubles.cs b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseTestDoubles.cs new file mode 100644 index 0000000..88b81ce --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/TestDoubles/UseCaseTestDoubles.cs @@ -0,0 +1,55 @@ +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Moq; +using System.Dynamic; +using Bogus; + +namespace Dfe.Data.SearchPrototype.Common.Tests.CleanArchitecture.Application.UseCase.TestDoubles; + +public static class UseCaseTestDoubles +{ + public static Mock> UseCaseMock< + TUseCaseReponseMock>() => new(); + + public static Mock, TUseCaseReponse>> UseCaseMockWithArg() => new(); + + public static IUseCase MockUseCaseFor< + TUseCaseReponseMock>(TUseCaseReponseMock useCaseReponse) + { + var useCaseMock = UseCaseMock(); + + useCaseMock + .Setup(useCase => + useCase.HandleRequest()) + .Returns(MockUseCaseResponseFor(useCaseReponse)); + + return useCaseMock.Object; + } + + public static IUseCase, TUseCaseReponse> MockUseCaseWithArgFor< + TUseCaseReponse>(IUseCaseRequest useCaseRequest, TUseCaseReponse useCaseReponse) + { + var useCaseWithArgMock = UseCaseMockWithArg(); + + useCaseWithArgMock + .Setup(useCase => + useCase.HandleRequest(useCaseRequest)) + .Returns(MockUseCaseResponseFor(useCaseReponse)); + + return useCaseWithArgMock.Object; + } + + public static Task MockUseCaseResponseFor< + TUseCaseResponse>(TUseCaseResponse useCaseResponseFake) => + Task.FromResult(useCaseResponseFake); + + public static ExpandoObject DefaultUseCaseResponseFake( + TUseCaseResponse useCaseResponse) + { + dynamic useCaseResponsefake = new ExpandoObject(); + useCaseResponsefake.UseCaseReponse = useCaseResponse; + return useCaseResponsefake; + } + + public static string DefaultUseCaseResponseMessage => new Faker().Random.Words(count: 10); +} diff --git a/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/UseCaseTests.cs b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/UseCaseTests.cs new file mode 100644 index 0000000..be9b1f2 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Tests/CleanArchitecture/Application/UseCase/UseCaseTests.cs @@ -0,0 +1,67 @@ + +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.Common.Tests.CleanArchitecture.Application.UseCase.TestDoubles; +using System.Dynamic; +using Xunit; + +namespace Dfe.Data.SearchPrototype.Common.Tests.CleanArchitecture.Application.UseCase; + +public class UseCaseTests +{ + [Fact] + public void UseCase_HandleRequest_No_Args_ReturnsExpectedUseCaseReponse() + { + // arrange + var useCaseResponseMessage = + UseCaseTestDoubles.DefaultUseCaseResponseMessage; + var useCaseResponsefake = + UseCaseTestDoubles.DefaultUseCaseResponseFake(useCaseResponseMessage); + IUseCase useCaseMock = + UseCaseTestDoubles.MockUseCaseFor(useCaseResponsefake); + + // act + var useCaseResponse = useCaseMock.HandleRequest(); + + // assert + Assert.Same( + useCaseResponseMessage, + useCaseResponse.Result.FirstOrDefault("UseCaseReponse")); + } + + [Fact] + public void UseCase_HandleRequest_With_Args_ReturnsExpectedUseCaseReponse() + { + // arrange + var useCaseResponseMessage = + UseCaseTestDoubles.DefaultUseCaseResponseMessage; + var useCaseResponsefake = + UseCaseTestDoubles.DefaultUseCaseResponseFake(useCaseResponseMessage); + var useCaseRequestMock = + UseCaseRequestTestDoubles.MockUseCaseRequest(); + IUseCase, ExpandoObject> useCaseWithArgMock = + UseCaseTestDoubles.MockUseCaseWithArgFor(useCaseRequestMock, useCaseResponsefake); + + // act + var useCaseResponse = + useCaseWithArgMock.HandleRequest(useCaseRequestMock); + + // assert + Assert.Same( + useCaseResponseMessage, + useCaseResponse.Result.FirstOrDefault("UseCaseReponse")); + } +} + +public static class ExpandoObjectExtensions +{ + public static TUnderlyingType? FirstOrDefault( + this ExpandoObject expandoObject, string key) + { + object? underlyingObject = + expandoObject.FirstOrDefault(kvp => + kvp.Key.Trim() == key.Trim()).Value; + + return (underlyingObject is TUnderlyingType type) ? + type : default; + } +} \ No newline at end of file diff --git a/Dfe.Data.SearchPrototype/Common/Tests/Dfe.Data.SearchPrototype.Common.Tests.csproj b/Dfe.Data.SearchPrototype/Common/Tests/Dfe.Data.SearchPrototype.Common.Tests.csproj new file mode 100644 index 0000000..4e23b58 --- /dev/null +++ b/Dfe.Data.SearchPrototype/Common/Tests/Dfe.Data.SearchPrototype.Common.Tests.csproj @@ -0,0 +1,30 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/Dfe.Data.SearchPrototype/Dfe.Data.SearchPrototype.csproj b/Dfe.Data.SearchPrototype/Dfe.Data.SearchPrototype.csproj index ca7f587..d60f741 100644 --- a/Dfe.Data.SearchPrototype/Dfe.Data.SearchPrototype.csproj +++ b/Dfe.Data.SearchPrototype/Dfe.Data.SearchPrototype.csproj @@ -8,16 +8,19 @@ + + + @@ -32,5 +35,9 @@ + + + + diff --git a/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs b/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs index d3ee6cf..1818e8c 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/CognitiveSearchServiceAdapter.cs @@ -6,75 +6,74 @@ using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch.Search; -namespace Dfe.Data.SearchPrototype.Infrastructure +namespace Dfe.Data.SearchPrototype.Infrastructure; + +/// +/// Provides an adaption of the core Azure cognitive search services to allow +/// compatibility with the Dfe.Data.SearchPrototype application search service definition. +/// +public sealed class CognitiveSearchServiceAdapter : ISearchServiceAdapter where TSearchResult : class { + private readonly ISearchService _cognitiveSearchService; + private readonly ISearchOptionsFactory _searchOptionsFactory; + private readonly IMapper>, EstablishmentResults> _searchResponseMapper; + /// - /// Provides an adaption of the core Azure cognitive search services to allow - /// compatibility with the Dfe.Data.SearchPrototype application search service definition. + /// The following dependencies include the core cognitive search service definition, + /// the complete implementation of which is defined in the IOC container. /// - public sealed class CognitiveSearchServiceAdapter : ISearchServiceAdapter where TSearchResult : class + /// + /// Cognitive search service definition injected via IOC container. + /// + /// + /// Factory class definition for prescribing the requested search options (by collection context). + /// + /// + /// Maps the raw azure search response to the required "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" + /// + public CognitiveSearchServiceAdapter( + ISearchService cognitiveSearchService, + ISearchOptionsFactory searchOptionsFactory, + IMapper>, EstablishmentResults> searchResponseMapper) { - private readonly ISearchService _cognitiveSearchService; - private readonly ISearchOptionsFactory _searchOptionsFactory; - private readonly IMapper>, EstablishmentResults> _searchResponseMapper; + _searchOptionsFactory = searchOptionsFactory; + _cognitiveSearchService = cognitiveSearchService; + _searchResponseMapper = searchResponseMapper; + } - /// - /// The following dependencies include the core cognitive search service definition, - /// the complete implementation of which is defined in the IOC container. - /// - /// - /// Cognitive search service definition injected via IOC container. - /// - /// - /// Factory class definition for prescribing the requested search options (by collection context). - /// - /// - /// Maps the raw azure search response to the required "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" - /// - public CognitiveSearchServiceAdapter( - ISearchService cognitiveSearchService, - ISearchOptionsFactory searchOptionsFactory, - IMapper>, EstablishmentResults> searchResponseMapper) - { - _searchOptionsFactory = searchOptionsFactory; - _cognitiveSearchService = cognitiveSearchService; - _searchResponseMapper = searchResponseMapper; - } + /// + /// Makes call to underlying azure cognitive search service and uses the prescribed mapper + /// to adapt the raw Azure search results to the "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" type. + /// + /// + /// Prescribes the context of the search including the keyword and collection target. + /// + /// + /// A configured "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" + /// object hydrated from the results of the azure search. + /// + /// + /// An application exception is thrown if we either have no options configured, which + /// is unrecoverable, or no azure search results are returned which should never be the + /// case given no matches should return an empty wrapper result object. + /// + public async Task SearchAsync(SearchContext searchContext) + { + SearchOptions searchOptions = + _searchOptionsFactory.GetSearchOptions(searchContext.TargetCollection) ?? + throw new ApplicationException( + $"Search options cannot be derived for {searchContext.TargetCollection}."); - /// - /// Makes call to underlying azure cognitive search service and uses the prescribed mapper - /// to adapt the raw Azure search results to the "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" type. - /// - /// - /// Prescribes the context of the search including the keyword and collection target. - /// - /// - /// A configured "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" - /// object hydrated from the results of the azure search. - /// - /// - /// An application exception is thrown if we either have no options configured, which - /// is unrecoverable, or no azure search results are returned which should never be the - /// case given no matches should return an empty wrapper result object. - /// - public async Task SearchAsync(SearchContext searchContext) - { - SearchOptions searchOptions = - _searchOptionsFactory.GetSearchOptions(searchContext.TargetCollection) ?? + Response> searchResults = + await _cognitiveSearchService.SearchAsync( + searchContext.SearchKeyword, + searchContext.TargetCollection, + searchOptions + ) + .ConfigureAwait(false) ?? throw new ApplicationException( - $"Search options cannot be derived for {searchContext.TargetCollection}."); - - Response> searchResults = - await _cognitiveSearchService.SearchAsync( - searchContext.SearchKeyword, - searchContext.TargetCollection, - searchOptions - ) - .ConfigureAwait(false) ?? - throw new ApplicationException( - $"Unable to derive search results based on input {searchContext.SearchKeyword}."); + $"Unable to derive search results based on input {searchContext.SearchKeyword}."); - return _searchResponseMapper.MapFrom(searchResults); - } + return _searchResponseMapper.MapFrom(searchResults); } } diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResponseToEstablishmentResultMapper.cs b/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResponseToEstablishmentResultMapper.cs index 118c8c1..360332d 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResponseToEstablishmentResultMapper.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResponseToEstablishmentResultMapper.cs @@ -1,7 +1,8 @@ using Azure; using Azure.Search.Documents.Models; +using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.Search; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; + namespace Dfe.Data.SearchPrototype.Infrastructure.Mappers; diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResultToEstablishmentMapper.cs b/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResultToEstablishmentMapper.cs index 7b71bcf..1b373c0 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResultToEstablishmentMapper.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Mappers/AzureSearchResultToEstablishmentMapper.cs @@ -1,38 +1,37 @@ -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; +using Dfe.Data.SearchPrototype.Common.Mappers; -namespace Dfe.Data.SearchPrototype.Infrastructure.Mappers +namespace Dfe.Data.SearchPrototype.Infrastructure.Mappers; + +/// +/// Facilitates mapping from the received T:Dfe.Data.SearchPrototype.Search.Establishment +/// into the required T:Dfe.Data.SearchPrototype.Search.Establishment object. +/// +public sealed class AzureSearchResultToEstablishmentMapper : IMapper { /// - /// Facilitates mapping from the received T:Dfe.Data.SearchPrototype.Search.Establishment - /// into the required T:Dfe.Data.SearchPrototype.Search.Establishment object. + /// The following mapping dependency provides the functionality to map from a raw Azure + /// search result, to a configured T:Dfe.Data.SearchPrototype.Search.Establishment + /// instance, the complete implementation of which is defined in the IOC container. /// - public sealed class AzureSearchResultToEstablishmentMapper : IMapper + /// + /// The raw T:Dfe.Data.SearchPrototype.Infrastructure.Establishment used to map from. + /// + /// + /// The configured T:Dfe.Data.SearchPrototype.Search.Establishment instance expected. + /// + /// + /// Exception thrown if either the id or name of an establishment is not provided + /// + public Search.Establishment MapFrom(Establishment input) { - /// - /// The following mapping dependency provides the functionality to map from a raw Azure - /// search result, to a configured T:Dfe.Data.SearchPrototype.Search.Establishment - /// instance, the complete implementation of which is defined in the IOC container. - /// - /// - /// The raw T:Dfe.Data.SearchPrototype.Infrastructure.Establishment used to map from. - /// - /// - /// The configured T:Dfe.Data.SearchPrototype.Search.Establishment instance expected. - /// - /// - /// Exception thrown if either the id or name of an establishment is not provided - /// - public Search.Establishment MapFrom(Establishment input) - { - if (string.IsNullOrEmpty(input.id)){ - throw new ArgumentException(nameof(input.id)); - } - - if (string.IsNullOrEmpty(input.ESTABLISHMENTNAME)){ - throw new ArgumentException(nameof(input.ESTABLISHMENTNAME)); - } + if (string.IsNullOrEmpty(input.id)){ + throw new ArgumentException(nameof(input.id)); + } - return new(urn: input.id, name: input.ESTABLISHMENTNAME); + if (string.IsNullOrEmpty(input.ESTABLISHMENTNAME)){ + throw new ArgumentException(nameof(input.ESTABLISHMENTNAME)); } + + return new(urn: input.id, name: input.ESTABLISHMENTNAME); } } diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Options/Mappers/SearchOptionsToAzureOptionsMapper.cs b/Dfe.Data.SearchPrototype/Infrastructure/Options/Mappers/SearchOptionsToAzureOptionsMapper.cs index 9109678..5ec3466 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Options/Mappers/SearchOptionsToAzureOptionsMapper.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Options/Mappers/SearchOptionsToAzureOptionsMapper.cs @@ -1,5 +1,5 @@ using Azure.Search.Documents; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; +using Dfe.Data.SearchPrototype.Common.Mappers; namespace Dfe.Data.SearchPrototype.Infrastructure.Options.Mappers; diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResponseToEstablishmentResultMapperTests.cs b/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResponseToEstablishmentResultMapperTests.cs index c3d6d53..06c2f56 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResponseToEstablishmentResultMapperTests.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResponseToEstablishmentResultMapperTests.cs @@ -1,9 +1,9 @@ using Azure; using Azure.Search.Documents.Models; +using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.Infrastructure.Mappers; using Dfe.Data.SearchPrototype.Infrastructure.Tests.TestDoubles; using Dfe.Data.SearchPrototype.Search; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using FluentAssertions; using Xunit; diff --git a/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResultToEstablishmentMapperTests.cs b/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResultToEstablishmentMapperTests.cs index a1beba5..54dd094 100644 --- a/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResultToEstablishmentMapperTests.cs +++ b/Dfe.Data.SearchPrototype/Infrastructure/Tests/Mappers/AzureSearchResultToEstablishmentMapperTests.cs @@ -1,5 +1,5 @@ -using Dfe.Data.SearchPrototype.Infrastructure.Mappers; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Infrastructure.Mappers; using FluentAssertions; using Xunit; diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/ISearchServiceAdapter.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/ISearchServiceAdapter.cs index d8eb55d..47e93fb 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/ISearchServiceAdapter.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/ISearchServiceAdapter.cs @@ -1,22 +1,21 @@ -namespace Dfe.Data.SearchPrototype.Search +namespace Dfe.Data.SearchPrototype.Search; + +/// +/// Describes behaviour for an adaption of core search services infrastructure to allow +/// compatibility with the Dfe.Data.SearchPrototype application search service definition. +/// +public interface ISearchServiceAdapter { /// - /// Describes behaviour for an adaption of core search services infrastructure to allow - /// compatibility with the Dfe.Data.SearchPrototype application search service definition. + /// Describes the required call to the underlying search service infrastructure and the expected + /// "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" type to be returned. /// - public interface ISearchServiceAdapter - { - /// - /// Describes the required call to the underlying search service infrastructure and the expected - /// "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" type to be returned. - /// - /// - /// Prescribes the context of the search including the keyword and collection target. - /// - /// - /// A configured "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" - /// object hydrated from the results of the azure search. - /// - Task SearchAsync(SearchContext searchContext); - } + /// + /// Prescribes the context of the search including the keyword and collection target. + /// + /// + /// A configured "T:Dfe.Data.SearchPrototype.Search.Domain.AgregateRoot.Establishments" + /// object hydrated from the results of the azure search. + /// + Task SearchAsync(SearchContext searchContext); } diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/ResultsToResponseMapper.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/ResultsToResponseMapper.cs index 517dc95..a12cac0 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/ResultsToResponseMapper.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/ResultsToResponseMapper.cs @@ -1,5 +1,5 @@ -using Dfe.Data.SearchPrototype.Search; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Search; namespace Dfe.Data.SearchPrototype.SearchForEstablishments; diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordUseCase.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordUseCase.cs index 7916d6c..5baa09c 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordUseCase.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchByKeywordUseCase.cs @@ -1,6 +1,6 @@ using Dfe.Data.SearchPrototype.Search; -using DfE.Data.ComponentLibrary.CleanArchitecture.CleanArchitecture.Application.UseCase; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; namespace Dfe.Data.SearchPrototype.SearchForEstablishments; diff --git a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchContext.cs b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchContext.cs index 8c3340f..043f1a0 100644 --- a/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchContext.cs +++ b/Dfe.Data.SearchPrototype/SearchForEstablishments/SearchContext.cs @@ -1,54 +1,53 @@ -namespace Dfe.Data.SearchPrototype.Search +namespace Dfe.Data.SearchPrototype.Search; + +/// +/// Prescribes the context of the search including the keyword and collection target. +/// +public sealed class SearchContext { /// - /// Prescribes the context of the search including the keyword and collection target. + /// The search keyword(s) to be applied. /// - public sealed class SearchContext - { - /// - /// The search keyword(s) to be applied. - /// - public string SearchKeyword { get; } - - /// - /// The target collection on which to apply the search. - /// - public string TargetCollection { get; } + public string SearchKeyword { get; } - /// - /// The following arguments are passed via the constructor and are not changeable - /// once an instance is created, this ensures we preserve immutability. - /// - /// - /// The search keyword(s) to be applied. - /// - /// - /// The target collection on which to apply the search. - /// - /// - public SearchContext(string searchKeyword, string targetCollection) - { - SearchKeyword = - (string.IsNullOrWhiteSpace(searchKeyword)) ? - throw new ArgumentNullException(nameof(searchKeyword)) : searchKeyword; + /// + /// The target collection on which to apply the search. + /// + public string TargetCollection { get; } - TargetCollection = - (string.IsNullOrWhiteSpace(targetCollection)) ? - throw new ArgumentNullException(nameof(targetCollection)) : targetCollection; - } + /// + /// The following arguments are passed via the constructor and are not changeable + /// once an instance is created, this ensures we preserve immutability. + /// + /// + /// The search keyword(s) to be applied. + /// + /// + /// The target collection on which to apply the search. + /// + /// + public SearchContext(string searchKeyword, string targetCollection) + { + SearchKeyword = + (string.IsNullOrWhiteSpace(searchKeyword)) ? + throw new ArgumentNullException(nameof(searchKeyword)) : searchKeyword; - /// - /// Factory method to allow implicit creation of a T:Dfe.Data.SearchPrototype.Search.SearchContext instance. - /// - /// - /// The keyword string which defines the search. - /// - /// - /// The underlying collection on which to undertake the search. - /// - /// - /// A configured T:Dfe.Data.SearchPrototype.Search.SearchContext instance. - /// - public static SearchContext Create(string searchKeyword, string targetCollection) => new(searchKeyword, targetCollection); + TargetCollection = + (string.IsNullOrWhiteSpace(targetCollection)) ? + throw new ArgumentNullException(nameof(targetCollection)) : targetCollection; } + + /// + /// Factory method to allow implicit creation of a T:Dfe.Data.SearchPrototype.Search.SearchContext instance. + /// + /// + /// The keyword string which defines the search. + /// + /// + /// The underlying collection on which to undertake the search. + /// + /// + /// A configured T:Dfe.Data.SearchPrototype.Search.SearchContext instance. + /// + public static SearchContext Create(string searchKeyword, string targetCollection) => new(searchKeyword, targetCollection); } diff --git a/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/ResultsToResponseMapperTests.cs b/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/ResultsToResponseMapperTests.cs index 58fb788..20e221e 100644 --- a/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/ResultsToResponseMapperTests.cs +++ b/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/ResultsToResponseMapperTests.cs @@ -1,7 +1,7 @@ -using Dfe.Data.SearchPrototype.Search; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Search; using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Tests.SearchForEstablishments.TestDoubles; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using FluentAssertions; using Xunit; diff --git a/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/SearchByKeywordUseCaseTests.cs b/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/SearchByKeywordUseCaseTests.cs index 20fd503..7dcdd95 100644 --- a/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/SearchByKeywordUseCaseTests.cs +++ b/Dfe.Data.SearchPrototype/Tests/SearchForEstablishments/SearchByKeywordUseCaseTests.cs @@ -1,7 +1,7 @@ -using Dfe.Data.SearchPrototype.Search; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Search; using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Tests.SearchForEstablishments.TestDoubles; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using FluentAssertions; using Xunit; diff --git a/Dfe.Data.SearchPrototype/Web/Controllers/HomeController.cs b/Dfe.Data.SearchPrototype/Web/Controllers/HomeController.cs index 0f9312d..50d1b29 100644 --- a/Dfe.Data.SearchPrototype/Web/Controllers/HomeController.cs +++ b/Dfe.Data.SearchPrototype/Web/Controllers/HomeController.cs @@ -1,7 +1,7 @@ +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Web.Models; -using DfE.Data.ComponentLibrary.CleanArchitecture.CleanArchitecture.Application.UseCase; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using Microsoft.AspNetCore.Mvc; namespace Dfe.Data.SearchPrototype.Web.Controllers; diff --git a/Dfe.Data.SearchPrototype/Web/Dfe.Data.SearchPrototype.Web.csproj b/Dfe.Data.SearchPrototype/Web/Dfe.Data.SearchPrototype.Web.csproj index 51d2dba..181d235 100644 --- a/Dfe.Data.SearchPrototype/Web/Dfe.Data.SearchPrototype.Web.csproj +++ b/Dfe.Data.SearchPrototype/Web/Dfe.Data.SearchPrototype.Web.csproj @@ -20,6 +20,7 @@ + diff --git a/Dfe.Data.SearchPrototype/Web/Mappers/SearchByKeywordResponseToViewModelMapper.cs b/Dfe.Data.SearchPrototype/Web/Mappers/SearchByKeywordResponseToViewModelMapper.cs index 6989d89..2a4faed 100644 --- a/Dfe.Data.SearchPrototype/Web/Mappers/SearchByKeywordResponseToViewModelMapper.cs +++ b/Dfe.Data.SearchPrototype/Web/Mappers/SearchByKeywordResponseToViewModelMapper.cs @@ -1,7 +1,6 @@ -using Dfe.Data.SearchPrototype.Search; +using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Web.Models; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; namespace Dfe.Data.SearchPrototype.Web.Mappers; diff --git a/Dfe.Data.SearchPrototype/Web/Program.cs b/Dfe.Data.SearchPrototype/Web/Program.cs index 391a962..1be51ee 100644 --- a/Dfe.Data.SearchPrototype/Web/Program.cs +++ b/Dfe.Data.SearchPrototype/Web/Program.cs @@ -1,20 +1,20 @@ +using Azure; +using Azure.Search.Documents; +using Azure.Search.Documents.Models; +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.Common.Mappers; using Dfe.Data.SearchPrototype.Infrastructure; +using Dfe.Data.SearchPrototype.Infrastructure.Mappers; +using Dfe.Data.SearchPrototype.Infrastructure.Options; +using Dfe.Data.SearchPrototype.Infrastructure.Options.Mappers; using Dfe.Data.SearchPrototype.Search; -using DfE.Data.ComponentLibrary.CleanArchitecture.CleanArchitecture.Application.UseCase; using Dfe.Data.SearchPrototype.SearchForEstablishments; +using Dfe.Data.SearchPrototype.Web.Mappers; +using Dfe.Data.SearchPrototype.Web.Models; +using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.Serialisation; using DfE.Data.ComponentLibrary.Infrastructure.CognitiveSearch; using GovUk.Frontend.AspNetCore; -using Azure.Search.Documents.Models; -using Azure; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; -using Dfe.Data.SearchPrototype.Infrastructure.Mappers; -using Azure.Search.Documents; -using Dfe.Data.SearchPrototype.Infrastructure.Options.Mappers; -using Dfe.Data.SearchPrototype.Infrastructure.Options; -using Dfe.Data.SearchPrototype.Web.Models; -using Dfe.Data.SearchPrototype.Web.Mappers; using Infrastructure = Dfe.Data.SearchPrototype.Infrastructure; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Json.Serialisation; using Search = Dfe.Data.SearchPrototype.Search; var builder = WebApplication.CreateBuilder(args); @@ -23,13 +23,11 @@ builder.Services.AddControllersWithViews(); builder.Services.AddGovUkFrontend(); - // Start of IOC container registrations // // builder.Services.AddAzureCognitiveSearchProvider(builder.Configuration); builder.Services.AddScoped(typeof(ISearchServiceAdapter), typeof(CognitiveSearchServiceAdapter)); -builder.Services.AddDefaultMappers(); builder.Services.AddScoped, SearchByKeywordUseCase>(); builder.Services.AddSingleton(typeof(IMapper>, EstablishmentResults>), typeof(AzureSearchResponseToEstablishmentResultMapper)); builder.Services.AddSingleton, SearchOptionsToAzureOptionsMapper>(); diff --git a/Dfe.Data.SearchPrototype/Web/Tests/Unit/Controllers/HomeControllerTests.cs b/Dfe.Data.SearchPrototype/Web/Tests/Unit/Controllers/HomeControllerTests.cs index 23b804d..8b4fbb4 100644 --- a/Dfe.Data.SearchPrototype/Web/Tests/Unit/Controllers/HomeControllerTests.cs +++ b/Dfe.Data.SearchPrototype/Web/Tests/Unit/Controllers/HomeControllerTests.cs @@ -1,10 +1,10 @@ -using Dfe.Data.SearchPrototype.Search; +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.Search; using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Web.Controllers; using Dfe.Data.SearchPrototype.Web.Models; using Dfe.Data.SearchPrototype.Web.Tests.Unit.TestDoubles; -using DfE.Data.ComponentLibrary.CleanArchitecture.CleanArchitecture.Application.UseCase; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using FluentAssertions; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; diff --git a/Dfe.Data.SearchPrototype/Web/Tests/Unit/Mappers/ServiceModelToViewModelMapperTests.cs b/Dfe.Data.SearchPrototype/Web/Tests/Unit/Mappers/ServiceModelToViewModelMapperTests.cs index fec30aa..4fb069f 100644 --- a/Dfe.Data.SearchPrototype/Web/Tests/Unit/Mappers/ServiceModelToViewModelMapperTests.cs +++ b/Dfe.Data.SearchPrototype/Web/Tests/Unit/Mappers/ServiceModelToViewModelMapperTests.cs @@ -1,8 +1,8 @@ -using Dfe.Data.SearchPrototype.SearchForEstablishments; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Web.Mappers; using Dfe.Data.SearchPrototype.Web.Models; using Dfe.Data.SearchPrototype.Web.Tests.Unit.TestDoubles; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using Xunit; namespace Dfe.Data.SearchPrototype.Web.Tests.Unit.Mappers; diff --git a/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchByKeywordUseCaseTestDouble.cs b/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchByKeywordUseCaseTestDouble.cs index b304319..482441a 100644 --- a/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchByKeywordUseCaseTestDouble.cs +++ b/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchByKeywordUseCaseTestDouble.cs @@ -1,5 +1,5 @@ -using Dfe.Data.SearchPrototype.SearchForEstablishments; -using DfE.Data.ComponentLibrary.CleanArchitecture.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.Common.CleanArchitecture.Application.UseCase; +using Dfe.Data.SearchPrototype.SearchForEstablishments; using Moq; namespace Dfe.Data.SearchPrototype.Web.Tests.Unit.TestDoubles; diff --git a/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchResultsToViewModelMapperTestDouble.cs b/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchResultsToViewModelMapperTestDouble.cs index 27ac5b4..59ec4b7 100644 --- a/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchResultsToViewModelMapperTestDouble.cs +++ b/Dfe.Data.SearchPrototype/Web/Tests/Unit/TestDoubles/SearchResultsToViewModelMapperTestDouble.cs @@ -1,6 +1,6 @@ -using Dfe.Data.SearchPrototype.SearchForEstablishments; +using Dfe.Data.SearchPrototype.Common.Mappers; +using Dfe.Data.SearchPrototype.SearchForEstablishments; using Dfe.Data.SearchPrototype.Web.Models; -using DfE.Data.ComponentLibrary.CrossCuttingConcerns.Mapping; using Moq; namespace Dfe.Data.SearchPrototype.Web.Tests.Unit.TestDoubles From eda1ba1cbf641b1229f5dece30f366d32ec29b0f Mon Sep 17 00:00:00 2001 From: Spencer O'HEGARTY Date: Wed, 24 Jul 2024 14:26:48 +0100 Subject: [PATCH 2/2] Removed common test project --- Dfe.Data.SearchPrototype.sln | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Dfe.Data.SearchPrototype.sln b/Dfe.Data.SearchPrototype.sln index 2578518..3f8be7e 100644 --- a/Dfe.Data.SearchPrototype.sln +++ b/Dfe.Data.SearchPrototype.sln @@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Common", "Dfe.Data.SearchPrototype\Common\Dfe.Data.SearchPrototype.Common.csproj", "{641005EB-1F41-466C-80C2-FA6F59572474}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dfe.Data.SearchPrototype.Common.Tests", "Dfe.Data.SearchPrototype\Common\Tests\Dfe.Data.SearchPrototype.Common.Tests.csproj", "{78EF8B69-F1FB-461B-8872-18FA7F285305}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -59,10 +57,6 @@ Global {641005EB-1F41-466C-80C2-FA6F59572474}.Debug|Any CPU.Build.0 = Debug|Any CPU {641005EB-1F41-466C-80C2-FA6F59572474}.Release|Any CPU.ActiveCfg = Release|Any CPU {641005EB-1F41-466C-80C2-FA6F59572474}.Release|Any CPU.Build.0 = Release|Any CPU - {78EF8B69-F1FB-461B-8872-18FA7F285305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {78EF8B69-F1FB-461B-8872-18FA7F285305}.Debug|Any CPU.Build.0 = Debug|Any CPU - {78EF8B69-F1FB-461B-8872-18FA7F285305}.Release|Any CPU.ActiveCfg = Release|Any CPU - {78EF8B69-F1FB-461B-8872-18FA7F285305}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE