public void Delete_NoPurge_AddCertificateToDeletedCertificates() { var deleteLogger = _loggerFactory.CreateLogger <KeyVaultCertificateDeleter>(); var addLogger = _loggerFactory.CreateLogger <KeyVaultCertificateAdder>(); var adder = new KeyVaultCertificateAdder(_client, addLogger); adder.Add(_certificateName); var deleter = new KeyVaultCertificateDeleter(_client, deleteLogger); deleter.Delete(new KeyVaultCertificateDeleteEvent { Name = _certificateName }); _client.GetDeletedCertificate(_certificateName).Value.Should().NotBeNull(); }
public void Delete_Purge_CompletelyRemovedCertificate() { var deleteLogger = _loggerFactory.CreateLogger <KeyVaultCertificateDeleter>(); var addLogger = _loggerFactory.CreateLogger <KeyVaultCertificateAdder>(); var adder = new KeyVaultCertificateAdder(_client, addLogger); adder.Add(_certificateName); var deleter = new KeyVaultCertificateDeleter(_client, deleteLogger); deleter.Delete(new KeyVaultCertificateDeleteEvent { Name = _certificateName, Purge = true }); Action action = () => _client.GetCertificate(_certificateName); action.Should().ThrowExactly <RequestFailedException>().Where(e => e.Message.Contains($"A certificate with (name/id) {_certificateName} was not found in this key vault.", StringComparison.InvariantCultureIgnoreCase)); action = () => _client.GetDeletedCertificate(_certificateName); action.Should().ThrowExactly <RequestFailedException>(); }
public IActionResult Post(KeyVaultCertificateDeleteEvent @event) { _certificateDeleter.Delete(@event); return(Accepted()); }