コード例 #1
0
        public void VerifyDecryption_GenericDecryptionFailed_ThrowsGpgError()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.DECRYPTION_FAILED, null)
                           .Build();

            Should.Throw <GpgError>(() => verifier.VerifyDecryption(result));
        }
コード例 #2
0
        public void VerifyDecryption_GenericFailure_ThrowsGpgException()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.FAILURE, null)
                           .Build();

            Should.Throw <GpgException>(() => verifier.VerifyDecryption(result));
        }
コード例 #3
0
        public void VerifyDecryption_NonZeroExitCode_ThrowsGpgException(int exitCode)
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithExitCode(exitCode)
                           .Build();

            Should.Throw <GpgException>(() => verifier.VerifyDecryption(result));
        }
コード例 #4
0
        public void VerifyEncryption_ZeroExitCode_DoesNotThrow()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithExitCode(0)
                           .Build();

            Should.NotThrow(() => verifier.VerifyEncryption(result));
        }
コード例 #5
0
        public void VerifyDecryption_DecryptionStatusOkay_DoesNotThrow()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.DECRYPTION_OKAY, null)
                           .WithStatusMessage(GpgStatusCode.END_DECRYPTION, null)
                           .Build();

            Should.NotThrow(() => verifier.VerifyDecryption(result));
        }
コード例 #6
0
        public void VerifyDecryption_NoData_ThrowsGpgError()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.FAILURE, null)
                           .WithStatusMessage(GpgStatusCode.NODATA, null)
                           .Build();

            Should.Throw <GpgError>(() => verifier.VerifyDecryption(result));
        }
コード例 #7
0
        public void VerifyEncryption_InvalidRecipient_ThrowsGpgError()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.FAILURE)
                           .WithStatusMessage(GpgStatusCode.INV_RECP, "rcp_a rcp_b")
                           .Build();

            Should.Throw <GpgError>(() => verifier.VerifyEncryption(result));
        }
コード例 #8
0
        public void VerifyEncryption_KeyExpired_ThrowsGpgError()
        {
            var verifier = new GpgResultVerifier();
            var result   = new GpgResultBuilder()
                           .WithStatusMessage(GpgStatusCode.FAILURE)
                           .WithStatusMessage(GpgStatusCode.INV_RECP, "rcp_a rcp_b")
                           .WithStatusMessage(GpgStatusCode.KEYEXPIRED)
                           .Build();

            var error = Should.Throw <GpgError>(() => verifier.VerifyEncryption(result));
        }