public GetCompetentAuthoritiesAndEntryOrExitPointsByCountryIdHandlerTests() { var entryOrExitPointRepository = A.Fake <IEntryOrExitPointRepository>(); var competentAuthorityMapper = new CompetentAuthorityMap(); var entryOrExitPointMapper = new EntryOrExitPointMap(); var countryWithData = CountryFactory.Create(countryWithDataId); var countryWithNoData = CountryFactory.Create(countryWithNoDataId); var competentAuthorities = new[] { CompetentAuthorityFactory.Create(new Guid("C74A75B9-C338-4330-A43A-3AAF3B8FA5E7"), countryWithData), CompetentAuthorityFactory.Create(new Guid("B076AF57-83EB-4F99-BDE6-859CC2B35FBE"), countryWithData) }; A.CallTo(() => entryOrExitPointRepository.GetForCountry(countryWithDataId)).Returns(new[] { EntryOrExitPointFactory.Create(new Guid("B054CA23-18D3-4E4E-A2B1-F92B7503919A"), countryWithData), EntryOrExitPointFactory.Create(new Guid("9F0DC969-8224-4FEC-BD0D-B90B70378323"), countryWithData) }); var repository = A.Fake <ICompetentAuthorityRepository>(); A.CallTo(() => repository.GetCompetentAuthorities(countryWithDataId)).Returns(competentAuthorities); handler = new GetCompetentAuthoritiesAndEntryOrExitPointsByCountryIdHandler(entryOrExitPointMapper, competentAuthorityMapper, repository, entryOrExitPointRepository); }
public GetCompetentAuthoritiesAndEntryPointsByCountryIdHandlerTests() { entryOrExitPointRepository = A.Fake <IEntryOrExitPointRepository>(); intraCountryExportAllowedRepository = A.Fake <IIntraCountryExportAllowedRepository>(); unitedKingdomCompetentAuthorityRepository = A.Fake <IUnitedKingdomCompetentAuthorityRepository>(); var iwsContext = new TestIwsContext(); var countryWithData = CountryFactory.Create(countryWithDataId); var unitedKingdomCountry = CountryFactory.Create(unitedKingdomCountryId); var countryWithNoData = CountryFactory.Create(countryWithNoDataId); competentAuthorities = new[] { CompetentAuthorityFactory.Create(new Guid("67D2B3B5-298A-4BB5-901C-0C0C80097242"), unitedKingdomCountry), CompetentAuthorityFactory.Create(new Guid("5E7CA40F-D7B5-49C3-8850-694D36D52C94"), countryWithData), CompetentAuthorityFactory.Create(new Guid("DFD98B0D-F255-4BA0-96A5-527DE9F973E3"), countryWithData) }; A.CallTo(() => unitedKingdomCompetentAuthorityRepository.GetAll()).Returns(new[] { new TestableUnitedKingdomCompetentAuthority(1, competentAuthorities[0], "something", null) }); var competentAuthorityMapper = new CompetentAuthorityMap(); var entryOrExitPointMapper = new EntryOrExitPointMap(); A.CallTo(() => entryOrExitPointRepository.GetForCountry(countryWithDataId)).Returns(new[] { EntryOrExitPointFactory.Create(new Guid("FC012C3E-4252-4D62-A8A2-D46DE0FA93B9"), countryWithData), EntryOrExitPointFactory.Create(new Guid("9699CC16-6EF1-4889-9598-F4B0511A2038"), countryWithData) }); A.CallTo(() => intraCountryExportAllowedRepository.GetImportCompetentAuthorities(UKCompetentAuthority.England)).Returns(new[] { new TestableIntraCountryExportAllowed { ExportCompetentAuthority = UKCompetentAuthority.England, ImportCompetentAuthorityId = competentAuthorities[1].Id } }); repository = A.Fake <ICompetentAuthorityRepository>(); A.CallTo(() => repository.GetCompetentAuthorities(countryWithDataId)).Returns(competentAuthorities); ids = new Guid[] { competentAuthorities[1].Id }; A.CallTo(repository).Where(call => call.Method.Name == "GetByIds") .WithReturnType <CompetentAuthority[]>() .Returns(competentAuthorities); handler = new GetCompetentAuthoritiesAndEntryPointsByCountryIdHandler(entryOrExitPointMapper, competentAuthorityMapper, repository, entryOrExitPointRepository, intraCountryExportAllowedRepository, iwsContext, unitedKingdomCompetentAuthorityRepository); }