Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }