Example #1
0
 public MailServiceApiConsumerTests(MailServiceApiConsumerPact data)
 {
     mockProviderService = data.MockProviderService;
     mockProviderService
     .ClearInteractions();     // NOTE: Clears any previously registered interactions before the test is run
     mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
 }
Example #2
0
 public GuitarServiceConsumerTests(GuitarServicePact guitarServicePact)
 {
     _mockProviderService = guitarServicePact.MockProviderService;
     _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run
     _mockProviderServiceBaseUri = guitarServicePact.MockProviderServiceBaseUri;
     _mockProviderClient         = new MockProviderClient(_mockProviderServiceBaseUri);
 }
Example #3
0
 public static void SetupPact(TestContext _)
 {
     _pact        = new WeatherApiPact();
     _mockService = _pact.MockProviderService;
     _mockService.ClearInteractions();
     _mockServiceUri = _pact.MockProviderServiceBaseUri;
 }
Example #4
0
 public ConsumerPactTests(ConsumerPactClassFixture<Startup> fixture)
 {
     _mockProviderService = fixture.MockProviderService;
     _mockServiceBaseUri = fixture.MockProviderServiceBaseUri;
     _mockProviderService.ClearInteractions();
     
     Client = fixture.Client;
 }
Example #5
0
 public ConumerPactTest(WebApplicationFactory <Startup> factory, ConsumerEventApiPact data)
 {
     this.factory        = factory;
     this.data           = data;
     mockProviderService = data.MockProviderService;
     mockProviderService.ClearInteractions();
     mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
 }
Example #6
0
 public void Setup()
 {
     _fixture             = new ConsumerMyApiPact();
     _mockProviderService = _fixture.MockProviderService;
     _mockProviderService
     .ClearInteractions();     //NOTE: Clears any previously registered interactions before the test is run
     _mockProviderServiceBaseUri = _fixture.MockProviderServiceBaseUri;
 }
        public OrderControllerTest(OrdersConsumerPact consumerShipmentPact)
        {
            shipmentMockProviderService = consumerShipmentPact.ShipmentMockProviderService;
            // NOTE: clears any previously registered interactions before the test is run
            shipmentMockProviderService.ClearInteractions();

            orderServiceTestServer = new OrderServiceTestServer();
        }
        public void Setup()
        {
            _mockProviderService = _consumerExampleApiPact.MockProviderService;
            _mockProviderService
            .ClearInteractions();     //NOTE: Clears any previously registered interactions before the test is run

            _mockProviderServiceBaseUri = _consumerExampleApiPact.MockProviderServiceBaseUri;
        }
Example #9
0
        public void SetUp()
        {
            ApiConsumerTests test = new ApiConsumerTests();

            _mockProviderService = data1.MockProviderService;
            _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run
            _mockProviderServiceBaseUri = "https://jsonplaceholder.typicode.com";
        }
Example #10
0
        public void Setup()
        {
            PactBuilder = new PactBuilder()
                          .ServiceConsumer(_consumerName)
                          .HasPactWith(_providerName);

            MockProviderService = PactBuilder.MockService(MockServerPort);
            MockProviderService.ClearInteractions();
        }
Example #11
0
 public alcoholic_should(PactConsumer data)
 {
     mockProviderService = data.MockProviderService;
     mockProviderService.ClearInteractions();
     //Clears any previously registered interactions before the test is run
     serviceBaseUri = data.MockProviderServiceBaseUri;
     alcoholic      = new Alcoholic(
         new RestProxy(),
         serviceBaseUri + BEERS_PATH);
 }
        // public SomethingApiConsumerTests(ConsumerMyApiPact data)
        public SomethingApiConsumerTests()
        {
            _data = new ConsumerMyApiPact();
            var data = _data;

            _mockProviderService = data.MockProviderService;
            _mockProviderService
            .ClearInteractions();     //NOTE: Clears any previously registered interactions before the test is run
            _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
        }
Example #13
0
        public ClientTests(OrderConsumerPact data)
        {
            _mockProviderService = data.MockProviderService;
            _mockProviderService.ClearInteractions();

            var httpClient = new HttpClient
            {
                BaseAddress = new Uri(data.MockProviderServiceBaseUri)
            };

            _sut = new Client(httpClient);
        }
        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();
        }
        public void SetFixture(MyobArlApiPact data)
        {
            _mockProviderService        = data.MockProviderService;
            _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
            _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run

            _configuration = Substitute.For <IApiConfiguration>();
            _service       = new TimesheetService(_configuration, keyService: new SimpleOAuthKeyService {
                OAuthResponse = new OAuthTokens {
                    ExpiresIn = 120
                }
            });

            _cfUid = Guid.NewGuid();
            _uid   = Guid.NewGuid();

            _cf = new CompanyFile
            {
                Uri = new Uri(string.Format("{0}/accountright/{1}", _mockProviderServiceBaseUri, _cfUid))
            };
        }
        public void GetCards_WhenHasCards_ShouldReturnCards()
        {
            _mockProviderService
            .Given("There is a card with card id '1'")
            .UponReceiving("A Get Request to retrieve the card")
            .With(new ProviderServiceRequest()
            {
                Method  = HttpVerb.Get,
                Path    = "/card/1",
                Headers = new Dictionary <string, string>
                {
                    { "Accept", "application/json" }
                }
            })
            .WillRespondWith(new ProviderServiceResponse
            {
                Status  = 200,
                Headers = new Dictionary <string, string>
                {
                    { "Content-Type", "application/json; content=utf-8" }
                },
                Body = new
                {
                    id          = 1,
                    displayName = "VISA"
                }
            });

            var consumer = new CardApiClient(_mockProviderServiceaBaseUrl);

            var result = consumer.GetCards(1);

            Assert.AreEqual(1, result.Id);

            //NOTE: Verifies that interactions registered on the mock provider are called once and only once
            _mockProviderService.VerifyInteractions();
            _mockProviderService.ClearInteractions();
            _cardServicePact.Build();
        }
Example #17
0
 public Consumer1Tests(PactConfigurator pactConfigurator)
 {
     _mockProviderService = pactConfigurator.MockProviderService;
     _mockProviderService.ClearInteractions();
     _baseUri = pactConfigurator.MockBaseUri;
 }
Example #18
0
 public RecipeServiceConsumerTest(RecipeServicePact data)
 {
     _mockProviderService = data.MockProviderService;
     _mockProviderService.ClearInteractions();
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
 }
 public ProductConsumerPactTest(PactTestFixture fixture)
 {
     _providerServiceUrl  = fixture.ProviderServiceUrl;
     _mockProviderService = fixture.MockProviderService;
     _mockProviderService.ClearInteractions();
 }
 public ProductApiTest(ConsumerProductApi productApi)
 {
     _mockProviderService = productApi.MockProviderService;
     _serviceBaseUri      = productApi.ServiceBaseUri;
     _mockProviderService.ClearInteractions();
 }
Example #21
0
 public Facts(ProviderApiPact pact)
 {
     _mockProviderService = pact.MockProviderService;
     _mockProviderService.ClearInteractions();
     _mockProviderServiceBaseUri = pact.MockProviderServiceBaseUri;
 }
Example #22
0
 public ValuesPactTest(ValuesApiMock fixture)
 {
     _mockProviderService = fixture.MockProviderService;
     _mockProviderService.ClearInteractions();
     _serviceUri = fixture.ServiceUri;
 }
Example #23
0
 public QuizClientTests(QuizServiceApiPact data)
 {
     _mockProviderService = data.MockProviderService;
     _mockProviderService.ClearInteractions();
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
 }
Example #24
0
 public void TestSetup()
 {
     _mockProviderService.ClearInteractions();
     _sqsRegionStockApiClient = new SqsRegionStockApiClient($"http://{Environment.MachineName}:{MockSqsApiPort}");
 }
Example #25
0
 public PactBuilderIntegrationTests(IntegrationTestsMyApiPact data)
 {
     _mockProviderService        = data.MockProviderService;
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
     _mockProviderService.ClearInteractions();
 }
Example #26
0
 public CarsApiConsumerTests(ConsumerCarApiPact data)
 {
     _mockProviderService        = data.MockProviderService;
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
     _mockProviderService.ClearInteractions();
 }
 public ConsumerPactTests(ConsumerPactClassFixture fixture)
 {
     _mockProviderService = fixture.MockProviderService;
     _mockProviderService.ClearInteractions(); //NOTE: Clears any previously registered interactions before the test is run
     _mockProviderServiceBaseUri = fixture.MockProviderServiceBaseUri;
 }
 public ConsumerPactTest(ConsumerPact data)
 {
     _mockProviderService = data.MockProviderService;
     _mockProviderService.ClearInteractions();
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
 }
Example #29
0
 public ConsumerPactTests(ConsumerPactClassFixture fixture)
 {
     _mockProviderService = fixture.MockProviderService;
     _mockProviderService.ClearInteractions();
     _mockProviderServiceBaseUri = fixture.MockProviderServiceBaseUri;
 }
Example #30
0
 public void SetFixture(ConsumerEventApiPact data)
 {
     _mockProviderService        = data.MockProviderService;
     _mockProviderServiceBaseUri = data.MockProviderServiceBaseUri;
     _mockProviderService.ClearInteractions();
 }