Esempio n. 1
0
        public void RePublishShouldPublishWithRePublishLogAction()
        {
            const string key            = "key";
            const string packageId      = "id";
            const string packageVersion = "version";

            PackagePublishingService.RePublish(key, packageId, packageVersion);

            MockedPackagePublisher.Verify(pp => pp.PublishPackage(key, packageId, packageVersion, PackageLogAction.RePublish), Times.Once(),
                                          "Package publisher should have been invoked with the correct PackageLogAction.");
        }
Esempio n. 2
0
        public void ShouldThrowWebFaultExceptionWhenRePublishThrows()
        {
            var expectedException = new WebFaultException <string>(null, HttpStatusCode.Accepted);

            MockedPackagePublisher.Setup(pp => pp.PublishPackage(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <PackageLogAction>()))
            .Throws(new Exception());
            MockedWebFaultExceptionFactory.Setup(wfef => wfef.CreateWebFaultException(It.IsAny <Exception>(), It.IsAny <string>())).Returns(expectedException);

            TestDelegate methodThatShouldThrow = () => PackagePublishingService.RePublish(null, null, null);

            ExceptionAssert.Throws(methodThatShouldThrow, expectedException, "Incorrect exception thrown.");
        }