Esempio n. 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);
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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()
            });
        }
Esempio n. 8
0
 public void StartMockService()
 {
     Port = int.Parse(Config["providerService:port"]);
     MockProviderService = PactBuilder.MockService(Port);
     MockProviderService.ClearInteractions();
 }
Esempio n. 9
0
 private ServiceAccessPact()
 {
     MockProviderService = PactBuilder.MockService(MockServerPort);
 }