public void WhenRegisteringTheSameInteractionTwiceInATest_ThenPactFailureExceptionIsThrown() { var description = "A POST request to create a new thing"; var request = new ProviderServiceRequest { Method = HttpVerb.Post, Path = "/things", Headers = new Dictionary <string, string> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new { thingId = 1234, type = "Awesome" } }; var response = new ProviderServiceResponse { Status = 201 }; _mockProviderService .UponReceiving(description) .With(request) .WillRespondWith(response); _mockProviderService .UponReceiving(description) .With(request); Assert.Throws <PactFailureException>(() => _mockProviderService.WillRespondWith(response)); }
public void WillRespondWith(ProviderServiceResponse response) { _decoratedMockProvider.WillRespondWith(response); }