public SetExitCustomsOfficeForNotificationByIdHandlerTests() { this.context = new TestIwsContext(); var repository = A.Fake<ITransportRouteRepository>(); anyNotification = NotificationApplicationFactory.Create(TestIwsContext.UserId, NotificationType.Recovery, UKCompetentAuthority.England, 0); EntityHelper.SetEntityId(anyNotification, notificationId); transport = new TransportRoute(notificationId); context.NotificationApplications.Add(anyNotification); context.TransportRoutes.Add(transport); country = CountryFactory.Create(AnyGuid); nonEuCountry = CountryFactory.Create(new Guid("606ECF5A-6571-4803-9CCA-7E1AF82D147A"), "test", false); context.Countries.AddRange(new[] { country, nonEuCountry }); stateOfExport = new StateOfExport(country, CompetentAuthorityFactory.Create(AnyGuid, country), EntryOrExitPointFactory.Create(AnyGuid, country)); stateOfImportNonEu = new StateOfImport(nonEuCountry, CompetentAuthorityFactory.Create(new Guid("5E4F1F22-5054-449B-9EC7-933A43BB5D6D"), nonEuCountry), EntryOrExitPointFactory.Create(new Guid("9781324F-17B8-4009-89B2-C18963E3E6E1"), nonEuCountry)); A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(transport); this.handler = new SetExitCustomsOfficeForNotificationByIdHandler(context, repository); }
public SetExitCustomsOfficeForNotificationByIdHandlerTests() { this.context = new TestIwsContext(); var repository = A.Fake <ITransportRouteRepository>(); anyNotification = NotificationApplicationFactory.Create(TestIwsContext.UserId, NotificationType.Recovery, UKCompetentAuthority.England, 0); EntityHelper.SetEntityId(anyNotification, notificationId); transport = new TransportRoute(notificationId); context.NotificationApplications.Add(anyNotification); context.TransportRoutes.Add(transport); country = CountryFactory.Create(AnyGuid); nonEuCountry = CountryFactory.Create(new Guid("606ECF5A-6571-4803-9CCA-7E1AF82D147A"), "test", false); context.Countries.AddRange(new[] { country, nonEuCountry }); stateOfExport = new StateOfExport(country, CompetentAuthorityFactory.Create(AnyGuid, country), EntryOrExitPointFactory.Create(AnyGuid, country)); stateOfImportNonEu = new StateOfImport(nonEuCountry, CompetentAuthorityFactory.Create(new Guid("5E4F1F22-5054-449B-9EC7-933A43BB5D6D"), nonEuCountry), EntryOrExitPointFactory.Create(new Guid("9781324F-17B8-4009-89B2-C18963E3E6E1"), nonEuCountry)); A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(transport); this.handler = new SetExitCustomsOfficeForNotificationByIdHandler(context, repository); this.validator = A.Fake <ITransportRouteValidator>(); A.CallTo(() => this.validator.IsImportAndExportStatesCombinationValid(null, stateOfExport)).Returns(true); A.CallTo(() => this.validator.IsImportAndExportStatesCombinationValid(stateOfImportNonEu, stateOfExport)).Returns(true); }