Beispiel #1
0
 public void OneTimeSetUp()
 {
     _pactBuilder = new PactBuilder(new PactConfig {
         SpecificationVersion = "2.0.0"
     });
     _pactBuilder.ServiceConsumer("Consumer App").HasPactWith("Provider API");
     _mockProviderService = _pactBuilder.MockService(MockServerPort);
 }
Beispiel #2
0
 public ProviderService(string serviceConsumerName, string providerName, string configPath)
 {
     Config      = new EnvironmentsConfig(configPath).Config;
     PactBuilder = new PactBuilder(new PactConfig {
         PactDir = Config["pactConfig:pactDir"],
         LogDir  = Config["pactConfig:pactDir"],
         SpecificationVersion = Config["pactConfig:specificationVersion"]
     })
                   .ServiceConsumer(serviceConsumerName)
                   .HasPactWith(providerName);
 }
        public void OneTimeSetUp()
        {
            _pactBuilder = new PactBuilder(new PactConfig {
                PactDir = @"c:\temp\pact\pactDir", LogDir = @"c:\temp\pact\logs"
            });

            _pactBuilder
            .ServiceConsumer(nameof(PactConsumer))
            .HasPactWith("PactProducer");

            _mockProviderService = _pactBuilder.MockService(MockServerPort);
            _mockProviderService.ClearInteractions();
        }
Beispiel #4
0
        public APIPact()
        {
            _pactBuilder = new PactBuilder(new PactConfig
            {
                PactDir = @"..\..\..\..\pacts",
                LogDir  = @"..\..\..\..\logs"
            });

            _pactBuilder.ServiceConsumer("Consumer").HasPactWith("API");


            MockProviderService = _pactBuilder.MockService(MockServerPort);
        }
        public static IMockProviderService GetMockProviderService(this IPactBuilder pactBuilder)
        {
            var configuration = new Configuration();
            var mockService   = pactBuilder.MockService(
                configuration.MockProviderServerPort,
                new JsonSerializerSettings()
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });

            mockService.ClearInteractions();
            return(mockService);
        }
Beispiel #6
0
        public ConsumerApiMock()
        {
            var pactConfig = new PactConfig
            {
                SpecificationVersion = "2.0.0",
                LogDir  = $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}logs{Path.DirectorySeparatorChar}",
                PactDir = $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}pacts{Path.DirectorySeparatorChar}"
            };

            _pactBuilder = new PactBuilder(pactConfig)
                           .ServiceConsumer("SomethingApiClient")
                           .HasPactWith("GetSomething");

            MockProviderService = _pactBuilder.MockService(MockServerPort, false, IPAddress.Any);
        }
Beispiel #7
0
        public void FixtureSetup()
        {
            var pactConfig = new PactConfig {
                PactDir = $"{ PactConstants.PactRootLocation}\\{PactConstants.PactProviderNames.SqsPocApi}\\{PactConstants.PactConsumerNames.Product}", LogDir = $"{ PactConstants.PactRootLocation }\\logs"
            };

            _pactBuilder = new PactBuilder(pactConfig);

            _pactBuilder
            .ServiceConsumer(PactConstants.PactConsumerNames.Product)
            .HasPactWith(PactConstants.PactProviderNames.SqsPocApi);

            _mockProviderService = _pactBuilder.MockService(
                MockSqsApiPort,
                Constants.JsonSettings);
        }
Beispiel #8
0
        public ValuesApiMock()
        {
            var pactConfig = new PactConfig
            {
                SpecificationVersion = "2.0.0",
                PactDir = @"..\..\..\pact",
                LogDir  = @".\pact_logs"
            };

            _pactBuilder = new PactBuilder(pactConfig)
                           .ServiceConsumer("Values")
                           .HasPactWith("otherApi");

            MockProviderService = _pactBuilder.MockService(ServicePort, new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            });
        }
 public Articles_POST_Tests(TestContractClassFixture consumerPactClassFixture)
 {
     _consumerPactClassFixture = consumerPactClassFixture;
     _pactBuilder         = _consumerPactClassFixture.GetPactBuilder(_httpVerb, _path);
     _mockProviderService = _pactBuilder.GetMockProviderService();
 }