public void Cannot_Assign_If_Country_Is_Not_Assigned() { //Arrange var countryId = A <int>(); var countryOption = new DataProcessingCountryOption { Id = countryId }; var registration = new DataProcessingRegistration { OrganizationId = A <int>(), InsecureCountriesSubjectToDataTransfer = { new DataProcessingCountryOption { Id = countryId + 1 } } }; ExpectGetAvailableOptionReturns(registration, countryId, countryOption); //Act var result = _sut.Assign(registration, countryId); //Assert Assert.True(result.Failed); Assert.Equal(OperationFailure.BadInput, result.Error.FailureType); Assert.NotEmpty(registration.InsecureCountriesSubjectToDataTransfer); }
public void Cannot_Assign_If_InsecureThirdCountryTransfer_Is_Not_Enabled() { //Arrange var registration = new DataProcessingRegistration { TransferToInsecureThirdCountries = YesNoUndecidedOption.No, OrganizationId = A <int>() }; var countryId = A <int>(); var countryOption = new DataProcessingCountryOption(); ExpectGetAvailableOptionReturns(registration, countryId, countryOption); //Act var result = _sut.Assign(registration, countryId); //Assert Assert.True(result.Failed); Assert.Equal(OperationFailure.BadInput, result.Error.FailureType); }
public void Can_Assign() { //Arrange var registration = new DataProcessingRegistration { TransferToInsecureThirdCountries = YesNoUndecidedOption.Yes, OrganizationId = A <int>() }; var countryId = A <int>(); var countryOption = new DataProcessingCountryOption(); ExpectGetAvailableOptionReturns(registration, countryId, countryOption); //Act var result = _sut.Assign(registration, countryId); //Assert Assert.True(result.Ok); Assert.Same(countryOption, result.Value); Assert.True(registration.InsecureCountriesSubjectToDataTransfer.Contains(countryOption)); }
public void Can_Remove() { //Arrange var countryId = A <int>(); var countryOption = new DataProcessingCountryOption { Id = countryId }; var registration = new DataProcessingRegistration { OrganizationId = A <int>(), InsecureCountriesSubjectToDataTransfer = { countryOption } }; ExpectGetOptionReturns(registration, countryId, countryOption); //Act var result = _sut.Remove(registration, countryId); //Assert Assert.True(result.Ok); Assert.Empty(registration.InsecureCountriesSubjectToDataTransfer); }
public void Cannot_Assign_If_Country_Is_Already_Assigned() { //Arrange var countryId = A <int>(); var countryOption = new DataProcessingCountryOption { Id = countryId }; var registration = new DataProcessingRegistration { TransferToInsecureThirdCountries = YesNoUndecidedOption.Yes, OrganizationId = A <int>(), InsecureCountriesSubjectToDataTransfer = { countryOption } }; ExpectGetAvailableOptionReturns(registration, countryId, countryOption); //Act var result = _sut.Assign(registration, countryId); //Assert Assert.True(result.Failed); Assert.Equal(OperationFailure.Conflict, result.Error.FailureType); }