Example #1
0
        public static VerificationRecord UpdateFrom(this VerificationRecord record, PactnetVerificationResult result)
        {
            record.Exception = result.Exception;

            record.Logs = result.Logs;

            record.Success = result.Success;

            return(record);
        }
        private PactnetVerificationResult VerifyUsingPactNet(string pactFile,
                                                             bool publishResultViaBroker, Models.Pact runningPact)
        {
            var result = new PactnetVerificationResult();

            var logger = new StringAppendOutput();

            var verifierConfig = new PactVerifierConfig
            {
                Outputters = new IOutput[] { logger },
                PublishVerificationResults = publishResultViaBroker,
                ProviderVersion            = "1"
            };

            var verifier = new PactVerifier(verifierConfig);

            verifier.ServiceProvider(runningPact.Provider?.Name, _serviceUri);

            verifier.PactUri(pactFile);

            try
            {
                verifier.Verify();

                result.Success = true;
            }
            catch (Exception e)
            {
                result.Success = false;

                result.Exception = e;
            }

            result.Logs = logger.Log;

            return(result);
        }