Ejemplo n.º 1
0
        public async Task FindMatchingOrganisationsHandler_IncludingSearchOnTradingName_ReturnsMatchingResults()
        {
            var data = new[]
            {
                orgHelper.GetOrganisationWithDetails("THE  Environemnt Agency", null, companyRegistrationNumber,
                                                     OrganisationType.RegisteredCompany, OrganisationStatus.Complete),
                orgHelper.GetOrganisationWithDetails("THE  Environemnt Agency", "THE Evironemnt Agency",
                                                     companyRegistrationNumber, OrganisationType.RegisteredCompany, OrganisationStatus.Complete),
                orgHelper.GetOrganisationWithDetails("THE Environemnt Agency", null, companyRegistrationNumber,
                                                     OrganisationType.SoleTraderOrIndividual, OrganisationStatus.Complete),
                orgHelper.GetOrganisationWithDetails("Other", "THE Environemnt Agency", companyRegistrationNumber,
                                                     OrganisationType.SoleTraderOrIndividual, OrganisationStatus.Complete),
                orgHelper.GetOrganisationWithDetails(null, "Environment Agency", companyRegistrationNumber,
                                                     OrganisationType.Partnership, OrganisationStatus.Complete)
            };

            A.CallTo(() => dataAccess.GetOrganisationsBySimpleSearchTerm(A <string> ._, A <Guid> ._))
            .Returns(data);

            var results = await FindMatchingOrganisationsHandler().HandleAsync(new FindMatchingOrganisations("Environment Agency"));

            Assert.Equal(data.Length, results.Results.Count());
        }