Beispiel #1
0
        public void ValidateKeysMatchInstanceShouldThrowWhenPackageIdsDoNotMatch()
        {
            Package packageInstance = new Package {
                Id = VALID_PACKAGE_ID + "different", Version = VALID_PACKAGE_VERSION
            };

            TestDelegate methodThatShouldThrow = () => _validator.ValidateKeysMatchInstance(VALID_PACKAGE_ID, VALID_PACKAGE_VERSION, packageInstance);

            Assert.Throws <InvalidPackageIdException>(methodThatShouldThrow, "Nonmatching PackageIds should throw correct exception.");
        }
Beispiel #2
0
        public void Update(string key, string id, string version, Package instance)
        {
            Action validateInputsAction = () =>
            {
                _serviceInputValidator.ValidateAllPackageKeys(key, id, version);
                _serviceInputValidator.ValidateKeysMatchInstance(id, version, instance);
            };

            ValidateInputs(validateInputsAction);
            Action updateAction = () => {
                _packageAuthenticator.EnsureKeyCanAccessPackage(key, id, version);
                _packageUpdater.UpdateExistingPackage(instance);
            };

            ExecuteAction(updateAction, "The Package could not be updated");
        }