示例#1
0
        public void ShouldCallUpdateOnPackageRepository()
        {
            var packageToUpdate = new Package();

            _packageUpdater.UpdateExistingPackage(packageToUpdate);

            _mockedPackageRepository.Verify(pr => pr.Update(packageToUpdate), Times.Once(),
                                            "PackageRepository's Update() should have been called exactly once with the expected Package.");
        }
示例#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");
        }