コード例 #1
0
        public void GivenSearchParametersWhenSearchServicesGatewayMethodIsCalledThenItReturnsResultsMatchingNameAndDescription()
        {
            // arrange
            var services   = EntityHelpers.CreateServices(10);
            var searchTerm = Randomm.Text();

            searchTerm = " " + searchTerm;//15 Feb 2021 - Change made so we only search for whole words in the service description! - So we add a space.

            services.First().Name += searchTerm;
            services[1].Description += searchTerm;
            var expectedData = new List <Service>();

            expectedData.Add(services.First());
            expectedData.Add(services[1]);
            var requestParams = new SearchServicesRequest();

            requestParams.Search = searchTerm;
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            // act
            var gatewayResult = _classUnderTest.SearchServices(requestParams);
            var fullMatches   = gatewayResult.FullMatchServices;

            // assert
            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            fullMatches.Count.Should().Be(2);
        }
コード例 #2
0
        public void GivenSearchParametersWhenSearchServicesGatewayMethodIsCalledThenItReturnsMatchingRecordsWithOrgNameHigherThanServiceName()
        {
            // arrange
            var services   = EntityHelpers.CreateServices(10);
            var searchTerm = Randomm.Text();

            services.First().Name += searchTerm;
            services[1].Organization.Name += searchTerm;
            var expectedData = new List <Service>();

            expectedData.Add(services.First());
            expectedData.Add(services[1]);
            var requestParams = new SearchServicesRequest();

            requestParams.Search = searchTerm;
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            // act
            var gatewayResult = _classUnderTest.SearchServices(requestParams);
            var fullMatches   = gatewayResult.FullMatchServices;

            // assert
            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            fullMatches.Count.Should().Be(2);
            fullMatches[0].Name.Should().Be(services[1].Name);
            fullMatches[1].Name.Should().Be(services[0].Name);
        }
コード例 #3
0
        [TestCase(TestName = "When SearchService Service controller method is called, Then it returns all ACTIVE services")] // ignores deleted ones // Assuming no default pagination - there's none yet
        public void SearchServiceEndpointReturnsAllActiveServices()                                                          // behaviour does not depend on filters
        {
            // arrange
            var services = EntityHelpers.CreateServices(10).ToList();
            //List<ServiceEntity> expectedData = services.Select(s => s.ToDomain()).ToList();

            var deletedService = EntityHelpers.CreateService();

            deletedService.Status         = "deleted";
            deletedService.OrganizationId = null;
            deletedService.Organization   = null;
            services.Add(deletedService);                           // added 11th service (broken)

            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            // act
            var gatewayResult    = _classUnderTest.SearchServices(new SearchServicesRequest());
            var fullMatches      = gatewayResult.FullMatchServices;
            var splitMatches     = gatewayResult.SplitMatchServices;
            var returnedServices = fullMatches.Concat(splitMatches).ToList();

            // assert
            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            splitMatches.Should().NotBeNull();

            fullMatches.Should().BeOfType <List <ServiceEntity> >();
            splitMatches.Should().BeOfType <List <ServiceEntity> >();

            returnedServices.Should().NotContain(s => s.Status == "deleted");
            returnedServices.Count.Should().Be(10);
        }
コード例 #4
0
        public async Task GetServicesBySearchParamsReturnServicesIfMatchedToSynonymGroup()
        {
            var synonymGroup1 = EntityHelpers.CreateSynonymGroupWithWords(5);
            var synonymGroup2 = EntityHelpers.CreateSynonymGroupWithWords(3);

            synonymGroup2.SynonymWords.ToList()[1].Word = synonymGroup1.SynonymWords.ToList()[1].Word;
            var services       = EntityHelpers.CreateServices();
            var serviceToFind1 = EntityHelpers.CreateService();
            var serviceToFind2 = EntityHelpers.CreateService();
            var searchTerm     = synonymGroup1.SynonymWords.ToList()[1].Word;

            serviceToFind1.Name += synonymGroup1.SynonymWords.ToList()[4].Word;
            serviceToFind2.Name += synonymGroup2.SynonymWords.ToList()[2].Word;
            DatabaseContext.SynonymGroups.Add(synonymGroup1);
            DatabaseContext.SynonymGroups.Add(synonymGroup2);
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.Services.Add(serviceToFind1);
            DatabaseContext.Services.Add(serviceToFind2);
            DatabaseContext.SaveChanges();
            var requestUri = new Uri($"api/v1/services?search={searchTerm}", UriKind.Relative);
            var response   = Client.GetAsync(requestUri).Result;

            response.StatusCode.Should().Be(200);
            var content       = response.Content;
            var stringContent = await content.ReadAsStringAsync().ConfigureAwait(false);

            var deserializedBody = JsonConvert.DeserializeObject <GetServiceResponseList>(stringContent);

            deserializedBody.Services.Count.Should().Be(2);
        }
コード例 #5
0
        public async Task GetServicesBySearchParamsReturnServicesIfMatched()
        {
            var services         = EntityHelpers.CreateServices().ToList();
            var expectedResponse = new GetServiceResponseList();

            expectedResponse.Services = new List <R.Service>();
            var serviceToFind1 = EntityHelpers.CreateService();
            var serviceToFind2 = EntityHelpers.CreateService();
            var searchTerm     = Randomm.Text();

            serviceToFind1.Name += searchTerm;
            serviceToFind2.Name += searchTerm;
            expectedResponse.Services.Add(serviceToFind1.ToDomain().ToResponse().Service);
            expectedResponse.Services.Add(serviceToFind2.ToDomain().ToResponse().Service);
            await DatabaseContext.Services.AddRangeAsync(services).ConfigureAwait(true);

            await DatabaseContext.Services.AddAsync(serviceToFind1).ConfigureAwait(true);

            await DatabaseContext.Services.AddAsync(serviceToFind2).ConfigureAwait(true);

            await DatabaseContext.SaveChangesAsync().ConfigureAwait(true);

            var requestUri = new Uri($"api/v1/services?search={searchTerm}", UriKind.Relative);
            var response   = Client.GetAsync(requestUri).Result;

            response.StatusCode.Should().Be(200);
            var content       = response.Content;
            var stringContent = await content.ReadAsStringAsync().ConfigureAwait(false);

            var deserializedBody = JsonConvert.DeserializeObject <GetServiceResponseList>(stringContent);

            deserializedBody.Services.Count.Should().Be(2);
        }
コード例 #6
0
        public async Task SearchServicesReturnServicesAccordingToRankIfMatched()
        {
            var searchWord1    = Randomm.Word();
            var searchWord2    = Randomm.Word();
            var irrelevantWord = Randomm.Word();
            var bridgeSyn1Word = Utility.SuperSetOfString(searchWord1);
            var bridgeSyn2Word = Utility.SuperSetOfString(searchWord2);
            var synWord1       = Randomm.Word();
            var synWord2       = Randomm.Word();
            var synWord3       = Randomm.Word();
            var synonymGroup1  = EntityHelpers.CreateSynonymGroupWithWords();
            var synonymGroup2  = EntityHelpers.CreateSynonymGroupWithWords();
            var dummySynGroup  = EntityHelpers.CreateSynonymGroupWithWords();
            var bridgeSynonym1 = EntityHelpers.SynWord(synonymGroup1, bridgeSyn1Word);
            var bridgeSynonym2 = EntityHelpers.SynWord(synonymGroup2, bridgeSyn2Word);
            var matchSynonym1  = EntityHelpers.SynWord(synonymGroup1, synWord1);
            var matchSynonym2  = EntityHelpers.SynWord(synonymGroup1, synWord2);
            var matchSynonym3  = EntityHelpers.SynWord(synonymGroup2, synWord3);

            synonymGroup1.SynonymWords.Add(bridgeSynonym1);
            synonymGroup2.SynonymWords.Add(bridgeSynonym2);
            synonymGroup1.SynonymWords.Add(matchSynonym1);
            synonymGroup1.SynonymWords.Add(matchSynonym2);
            synonymGroup2.SynonymWords.Add(matchSynonym3);
            var services      = EntityHelpers.CreateServices(5);
            var matchService1 = EntityHelpers.CreateService();
            var matchService2 = EntityHelpers.CreateService();
            var matchService3 = EntityHelpers.CreateService();
            var matchService4 = EntityHelpers.CreateService();

            matchService1.Name += searchWord2;
            //matchService2.Description += synWord2;
            matchService2.Description += " " + synWord2; //15 Feb 2021 - Change made so we only search for whole words in the service description! - So we add a space.

            matchService3.Organization.Name += synWord3;
            matchService4.Organization.Name += searchWord1;
            services.AddMany(matchService1, matchService2, matchService3, matchService4);
            DatabaseContext.SynonymGroups.AddRange(synonymGroup1);
            DatabaseContext.SynonymGroups.AddRange(synonymGroup2);
            DatabaseContext.SynonymGroups.AddRange(dummySynGroup);
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            var requestUri = new Uri($"api/v1/services?search={searchWord1} {searchWord2} {irrelevantWord}", UriKind.Relative);
            var response   = Client.GetAsync(requestUri).Result;

            response.StatusCode.Should().Be(200);
            var content       = response.Content;
            var stringContent = await content.ReadAsStringAsync().ConfigureAwait(false);

            var deserializedBody = JsonConvert.DeserializeObject <GetServiceResponseList>(stringContent);

            deserializedBody.Services.Count.Should().Be(4);
            deserializedBody.Services[0].Name.Should().Be(matchService4.Name);
            deserializedBody.Services[1].Name.Should().Be(matchService1.Name);
            deserializedBody.Services[2].Name.Should().Be(matchService3.Name);
            deserializedBody.Services[3].Name.Should().Be(matchService2.Name);
        }
コード例 #7
0
        public void GivenIdThatDoesNotHaveAMatchWhenGetServiceGatewayMethodIsCalledThenItReturnsNull()
        {
            // arrange
            var services = EntityHelpers.CreateServices();

            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            var id = Randomm.Id();

            // act
            var gatewayResult = _classUnderTest.GetService(id);

            // assert
            gatewayResult.Should().BeNull();
        }
コード例 #8
0
        public void GivenMultipleTaxonomyIdSearchParametersWhenSearchServicesGatewayMethodIsCalledThenItReturnsMatchingTaxonomyIdResults()
        {
            var taxonomy1 = EntityHelpers.CreateTaxonomy();
            var taxonomy2 = EntityHelpers.CreateTaxonomy();

            taxonomy1.Vocabulary = "demographic";
            taxonomy2.Vocabulary = "category";
            var services         = EntityHelpers.CreateServices();
            var serviceToFind1   = EntityHelpers.CreateService();
            var serviceToFind2   = EntityHelpers.CreateService();
            var serviceTaxonomy1 = EntityHelpers.CreateServiceTaxonomy();
            var serviceTaxonomy2 = EntityHelpers.CreateServiceTaxonomy();
            var serviceTaxonomy3 = EntityHelpers.CreateServiceTaxonomy();
            var serviceTaxonomy4 = EntityHelpers.CreateServiceTaxonomy();

            serviceTaxonomy1.Service  = serviceToFind1;
            serviceTaxonomy1.Taxonomy = taxonomy1;
            serviceTaxonomy2.Service  = serviceToFind1;
            serviceTaxonomy2.Taxonomy = taxonomy2;
            serviceTaxonomy3.Service  = serviceToFind2;
            serviceTaxonomy3.Taxonomy = taxonomy1;
            serviceTaxonomy4.Service  = serviceToFind2;
            serviceTaxonomy4.Taxonomy = taxonomy2;
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.Services.Add(serviceToFind1);
            DatabaseContext.Services.Add(serviceToFind2);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy1);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy2);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy3);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy4);
            DatabaseContext.SaveChanges();
            var requestParams = new SearchServicesRequest();

            requestParams.TaxonomyIds = new List <int> {
                taxonomy1.Id, taxonomy2.Id
            };
            var expectedData = new List <Service>();

            expectedData.Add(serviceToFind1);
            expectedData.Add(serviceToFind2);
            var gatewayResult = _classUnderTest.SearchServices(requestParams);
            var fullMatches   = gatewayResult.FullMatchServices;

            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            fullMatches.Count.Should().Be(expectedData.Count);
        }
コード例 #9
0
        public void GivenIdThatHasAMatchWhenGatewayMethodIsCalledThenTheServiceAnalyticsRecordGetsUpdated()
        {
            // arrange
            var services = EntityHelpers.CreateServices();

            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            var expectedResult = DatabaseContext.Services.First();
            var expectedId     = expectedResult.Id;

            // act
            var gatewayResult = _classUnderTest.GetService(expectedId);

            // assert
            expectedResult.ServiceAnalytics.Count.Should().Be(1);
        }
コード例 #10
0
        public void WhenDoingPartialTextSearchMatchesWordsOf3orLessCharactersLongGetIgnored()  //it's too short - these will be searched and found inside other words in DB
        {
            // arrange
            var shortWordList = new List <string> {
                "and", "a", "an", "the", "bfg", "42"
            };
            var shortWord = shortWordList.RandomItem();

            var word            = Randomm.Word().Replace(shortWord, "test");// have to ensure the shortword is not contained in the actual word for the sake of test
            var userSearchInput = $"{shortWord} {word}";

            var request = new SearchServicesRequest()
            {
                Search = userSearchInput
            };

            var services = EntityHelpers.CreateServices(5).ToList();             //dummy services

            services.ForEach(s => s.Name = s.Name.Replace(word, "ssj"));         //make sure they don't match the search word
            //assuming there's no full match. due to full match containing a shortword, the assertion at the bottom wouldn't be able to test what's needed.
            var serviceToFind = EntityHelpers.CreateService();                   // word 1 match

            serviceToFind.Name  = serviceToFind.Name.Replace(shortWord, "test"); //ensuring random hash does not contain shortword. for the assertion bellow to work as intended, the service name's hash part should not contain shortword.
            serviceToFind.Name += word;

            var serviceToNotFind = EntityHelpers.CreateService();                   // shortword no match. this ensures that the test can fail if the implementation is wrong or not present.

            serviceToNotFind.Name  = serviceToNotFind.Name.Replace(word, "1234");   // make sure the mismatching service does not contain a desired search term
            serviceToNotFind.Name += shortWord;

            services.Add(serviceToFind);
            services.Add(serviceToNotFind);
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            // act
            var gatewayResult = _classUnderTest.SearchServices(request);
            var splitMatches  = gatewayResult.SplitMatchServices;

            // assert
            gatewayResult.Should().NotBeNull();
            splitMatches.Should().NotBeNull();

            splitMatches.Should().NotContain(s => s.Name.Contains(shortWord, StringComparison.OrdinalIgnoreCase));
            splitMatches.Should().HaveCount(1);
        }
コード例 #11
0
        public void UponFilteringServicesByAMultiWordInputTheReturnedResultsIncludePartialMatches()
        {
            // arrange
            var word1           = Randomm.Word();
            var word2           = Randomm.Word();
            var userSearchInput = $"{word1} {word2}";

            var request = new SearchServicesRequest()
            {
                Search = userSearchInput
            };

            var services       = EntityHelpers.CreateServices(5).ToList();      // dummy services
            var serviceToFind1 = EntityHelpers.CreateService();                 // full match

            serviceToFind1.Name += userSearchInput;
            var serviceToFind2 = EntityHelpers.CreateService();                 // word 1 match

            serviceToFind2.Name += word1;
            var serviceToFind3 = EntityHelpers.CreateService();                 // word 2 match

            serviceToFind3.Name += word2;

            services.Add(serviceToFind1);
            services.Add(serviceToFind2);
            services.Add(serviceToFind3);
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            // act
            var gatewayResult    = _classUnderTest.SearchServices(request);
            var fullMatches      = gatewayResult.FullMatchServices;
            var splitMatches     = gatewayResult.SplitMatchServices;
            var returnedServices = fullMatches.Concat(splitMatches).ToList();

            // assert
            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            splitMatches.Should().NotBeNull();

            returnedServices.Should().Contain(s => s.Name.Contains(userSearchInput, StringComparison.OrdinalIgnoreCase));
            returnedServices.Should().Contain(s => s.Name.Contains(word1, StringComparison.OrdinalIgnoreCase));
            returnedServices.Should().Contain(s => s.Name.Contains(word2, StringComparison.OrdinalIgnoreCase));
            returnedServices.Should().HaveCount(3);
        }
コード例 #12
0
        public async Task GetServicesByTaxonomyIdServicesIfMatchedToTaxonomyId()
        {
            var taxonomy1 = EntityHelpers.CreateTaxonomy();
            var taxonomy2 = EntityHelpers.CreateTaxonomy();
            var taxonomy3 = EntityHelpers.CreateTaxonomy();

            taxonomy1.Vocabulary = "demographic";
            taxonomy2.Vocabulary = "category";
            taxonomy3.Vocabulary = "demographic";
            var services         = EntityHelpers.CreateServices();
            var serviceToFind1   = EntityHelpers.CreateService();
            var serviceToFind2   = EntityHelpers.CreateService();
            var serviceTaxonomy1 = EntityHelpers.CreateServiceTaxonomy();
            var serviceTaxonomy2 = EntityHelpers.CreateServiceTaxonomy();
            var serviceTaxonomy3 = EntityHelpers.CreateServiceTaxonomy();
            var searchTerm       = Randomm.Create <string>();

            serviceToFind1.Name      += searchTerm;
            serviceToFind2.Name      += searchTerm;
            serviceTaxonomy1.Service  = serviceToFind1;
            serviceTaxonomy1.Taxonomy = taxonomy1;
            serviceTaxonomy2.Service  = serviceToFind2;
            serviceTaxonomy2.Taxonomy = taxonomy2;
            serviceTaxonomy3.Service  = services.First();
            serviceTaxonomy3.Taxonomy = taxonomy2;
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.Services.Add(serviceToFind1);
            DatabaseContext.Services.Add(serviceToFind2);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy1);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy2);
            DatabaseContext.ServiceTaxonomies.Add(serviceTaxonomy3);
            DatabaseContext.Taxonomies.Add(taxonomy3);
            DatabaseContext.SaveChanges();
            var requestUri = new Uri($"api/v1/services?search={searchTerm}&taxonomyids={taxonomy2.Id}&taxonomyids={taxonomy3.Id}", UriKind.Relative);
            var response   = Client.GetAsync(requestUri).Result;

            response.StatusCode.Should().Be(200);
            var content       = response.Content;
            var stringContent = await content.ReadAsStringAsync().ConfigureAwait(false);

            var deserializedBody = JsonConvert.DeserializeObject <GetServiceResponseList>(stringContent);

            deserializedBody.Services.Count.Should().Be(0);
        }
コード例 #13
0
        public void GivenSearchParametersWhenSearchServicesGatewayMethodIsCalledThenItReturnsMatchingSynonymGroupResults()
        {
            // arrange
            var synonymGroup1 = EntityHelpers.CreateSynonymGroupWithWords(5);
            var synonymGroup2 = EntityHelpers.CreateSynonymGroupWithWords(3);

            synonymGroup2.SynonymWords.ToList()[1].Word = synonymGroup1.SynonymWords.ToList()[1].Word;
            var services = EntityHelpers.CreateServices();

            services.ForEach(s => s.Name = "irrelevant");
            var serviceToFind1 = EntityHelpers.CreateService();
            var serviceToFind2 = EntityHelpers.CreateService();
            var searchTerm     = synonymGroup1.SynonymWords.ToList()[1].Word;
            var requestParams  = new SearchServicesRequest();

            requestParams.Search = searchTerm;
            serviceToFind1.Name += synonymGroup1.SynonymWords.ToList()[4].Word;
            serviceToFind2.Name += synonymGroup2.SynonymWords.ToList()[2].Word;
            DatabaseContext.SynonymGroups.Add(synonymGroup1);
            DatabaseContext.SynonymGroups.Add(synonymGroup2);
            DatabaseContext.Services.AddRange(services);
            DatabaseContext.Services.Add(serviceToFind1);
            DatabaseContext.Services.Add(serviceToFind2);
            DatabaseContext.SaveChanges();
            var expectedData = new List <Service>();

            expectedData.Add(serviceToFind1);
            expectedData.Add(serviceToFind2);

            // act
            var gatewayResult    = _classUnderTest.SearchServices(requestParams);
            var fullMatches      = gatewayResult.FullMatchServices;
            var splitMatches     = gatewayResult.SplitMatchServices;
            var returnedServices = fullMatches.Concat(splitMatches).ToList();

            // assert
            gatewayResult.Should().NotBeNull();
            fullMatches.Should().NotBeNull();
            splitMatches.Should().NotBeNull();

            returnedServices.Count.Should().Be(expectedData.Count);
        }
コード例 #14
0
        public void GivenIdThatHasAMatchWhenGatewayMethodIsCalledThenItReturnsMatchingServiceDomainObject()
        {
            // arrange
            var services = EntityHelpers.CreateServices();

            DatabaseContext.Services.AddRange(services);
            DatabaseContext.SaveChanges();

            var expectedResult = DatabaseContext.Services.First();
            var expectedId     = expectedResult.Id;

            // act
            var gatewayResult = _classUnderTest.GetService(expectedId);

            // assert
            gatewayResult.Should().NotBeNull();
            gatewayResult.Should().BeEquivalentTo(expectedResult, options =>
            {
                options.Excluding(ex => ex.ServiceAnalytics);
                return(options);
            });
        }
コード例 #15
0
        public void WholeAndSplitUserInputMatchesAreReturnedInCorrectRank()
        {
            // arrange
            var searchWord1    = Randomm.Word();                         // word that won't match any results, however 1 of its synonyms from synonym group will
            var searchWord2    = Randomm.Word();                         // same as above, but the matching synonym will be in another synonym group
            var irrelevantWord = Randomm.Word();                         // a control word, that won't match anything, nor its synonyms will.

            var userInput = $"{searchWord1} "
                            + $"{irrelevantWord} "
                            + $"{searchWord2}";

            var request = new SearchServicesRequest();

            request.Search = userInput;

            var bridgeSyn1Word = Utility.SuperSetOfString(searchWord1);     // A superset word of search word 1 that will relate to a synonym word inside synonym group 1 - this word has no match in the DB
            var bridgeSyn2Word = Utility.SuperSetOfString(searchWord2);     // A superset word of search word 2 that will relate to a synonym word inside synonym group 2 - this word has no match in the DB


            var synWord1 = Randomm.Word();                            // synonym within the same synonym group (1) as a word related to search word 1 - this word has a match in the DB
            var synWord2 = Randomm.Word();                            // synonym within the same synonym group (1) as a word related to search word 1 - this word has a match in the DB
            var synWord3 = Randomm.Word();                            // synonym within the same synonym group (2) as a word related to search word 2 - this word has a match in the DB


            var synonymGroup1 = EntityHelpers.CreateSynonymGroupWithWords();            // relevant group with dummy synonym words
            var synonymGroup2 = EntityHelpers.CreateSynonymGroupWithWords();            // relevant group with dummy synonym words
            var dummySynGroup = EntityHelpers.CreateSynonymGroupWithWords();            // dummy synonym group that should not be picked up

            var bridgeSynonym1 = EntityHelpers.SynWord(synonymGroup1, bridgeSyn1Word);  // synonym that has no match in DB, however it bridges user input search word with the synonym group 1
            var bridgeSynonym2 = EntityHelpers.SynWord(synonymGroup2, bridgeSyn2Word);

            var matchSynonym1 = EntityHelpers.SynWord(synonymGroup1, synWord1);         // creating a synonym word object to insert that will have a match, creating a link with synonym group 1
            var matchSynonym2 = EntityHelpers.SynWord(synonymGroup1, synWord2);
            var matchSynonym3 = EntityHelpers.SynWord(synonymGroup2, synWord3);


            synonymGroup1.SynonymWords.Add(bridgeSynonym1);                  // added bridge synonym to the synonym group
            synonymGroup2.SynonymWords.Add(bridgeSynonym2);

            synonymGroup1.SynonymWords.Add(matchSynonym1);                   // added match synonym into a synonym group
            synonymGroup1.SynonymWords.Add(matchSynonym2);
            synonymGroup2.SynonymWords.Add(matchSynonym3);


            var services = EntityHelpers.CreateServices(5);                               // creating list of dummy services that should not be found

            var matchService1 = EntityHelpers.CreateService();                            // service that is intended to be found through the synonym of synonym group 1
            var matchService2 = EntityHelpers.CreateService();                            // service that is intended to be found through the synonym of synonym group 1
            var matchService3 = EntityHelpers.CreateService();                            // service that is intended to be found through the synonym of synonym group 2
            var matchService4 = EntityHelpers.CreateService();                            // service that is intended to be found through the main search term

            matchService1.Name += searchWord2;                                            // creating a link between a service and a match synonym 1
                                                                                          // creating a link between a service and a match synonym 2
            matchService2.Description += " " + synWord2;                                  //15 Feb 2021 - Change made so we only search for whole words in the service description! - So we add a space.

            matchService3.Organization.Name += synWord3;                                  // creating a link between a service and a match synonym 3
            matchService4.Organization.Name += searchWord1;                               // creating a link between a service and a main search word

            services.AddMany(matchService1, matchService2, matchService3, matchService4); // include match services into a to be inserted services collection

            DatabaseContext.SynonymGroups.AddRange(synonymGroup1);                        // adding synonym groups containing synonym words into a database
            DatabaseContext.SynonymGroups.AddRange(synonymGroup2);
            DatabaseContext.SynonymGroups.AddRange(dummySynGroup);
            DatabaseContext.Services.AddRange(services);                     // adding services into a database

            DatabaseContext.SaveChanges();

            // act
            var gatewayResult = _classUnderTest.SearchServices(request);
            var splitMatches  = gatewayResult.SplitMatchServices;
            var fullMatches   = gatewayResult.FullMatchServices;

            // assert
            splitMatches.Should().HaveCount(4);
            fullMatches.Should().HaveCount(0);
            splitMatches[0].Name.Should().Be(matchService4.Name);
            splitMatches[1].Name.Should().Be(matchService1.Name);
            splitMatches[2].Name.Should().Be(matchService3.Name);
            splitMatches[3].Name.Should().Be(matchService2.Name);
        }