Exemple #1
0
        public void ShouldThrowWebFaultExceptionWhenUpdaterThrows()
        {
            MockedPackageUpdater.Setup(pu => pu.UpdateExistingPackage(It.IsAny <Package>()))
            .Throws(new Exception());

            TestDelegate methodThatShouldThrow = () => PackageService.Update(null, null, null, null);

            Assert.Throws <WebFaultException <string> >(methodThatShouldThrow, "Incorrect type of exception thrown.");
        }
Exemple #2
0
        public void ShouldCallPackageUpdater()
        {
            const string key             = "key";
            const string packageId       = "id";
            const string packageVersion  = "version";
            var          packageToUpdate = new Package();

            PackageService.Update(key, packageId, packageVersion, packageToUpdate);

            MockedPackageUpdater.Verify(pu => pu.UpdateExistingPackage(packageToUpdate), Times.Once(),
                                        "Package updater should have been invoked.");
        }