public void SetStateOfImport_SameCountryToStateOfExportIfNoSameCountryExportsAllowed_Throws() { // Arrange var exportCountry = countries[0]; var exportCompetentAuthority = CompetentAuthorityFactory.Create(guids[0], exportCountry); var exportExitPoint = EntryOrExitPointFactory.Create(guids[0], exportCountry); var importCompetentAuthority = CompetentAuthorityFactory.Create(guids[1], exportCountry); var importExitPoint = EntryOrExitPointFactory.Create(guids[1], exportCountry); var stateOfExport = new StateOfExport(exportCountry, exportCompetentAuthority, exportExitPoint); var stateOfImport = new StateOfImport(exportCountry, importCompetentAuthority, importExitPoint); A.CallTo(() => this.validator.IsImportAndExportStatesCombinationValid(null, stateOfExport)).Returns(true); A.CallTo(() => this.validator.IsImportAndExportStatesCombinationValid(stateOfImport, stateOfExport)).Returns(false); // Act var intraCountryExportAlloweds = new TestableIntraCountryExportAllowed[0]; transportRoute.SetStateOfExportForNotification(stateOfExport, this.validator); // Assert Assert.Throws <InvalidOperationException>(() => transportRoute.SetStateOfImportForNotification(stateOfImport, this.validator)); }
public void SetStateOfExport_NotificationAlreadyHasStateOfExport_Overwrites() { var competentAuthority = GetTestCompetentAuthority(countries[0]); var exitPoint = GetTestEntryOrExitPoint(countries[0]); var stateOfExport = new StateOfExport(countries[0], competentAuthority, exitPoint); var intraCountryExportAlloweds = new TestableIntraCountryExportAllowed[0]; A.CallTo(() => this.validator.IsImportAndExportStatesCombinationValid(null, stateOfExport)).Returns(true); transportRoute.SetStateOfExportForNotification(stateOfExport, this.validator); Assert.Equal(stateOfExport.Country.Id, transportRoute.StateOfExport.Country.Id); }