public void Add_customer() { //Arrange _mockProviderService .Given("There is a service") .UponReceiving("A POST request to create a customer") .With(new ProviderServiceRequest { Method = HttpVerb.Post, Path = "/customers", Query = "", Headers = new Dictionary <string, object> { { "Content-Type", "application/json; charset=utf-8" } }, Body = new Customer { Firstname = "richard", Surname = "parkins" } }) .WillRespondWith(new ProviderServiceResponse { Status = 201, Headers = new Dictionary <string, object> { { "Content-Type", "application/json; charset=utf-8" }, { "Location", "http://localhost:5000/customers/richard-parkins" } }, Body = new Customer { Id = "richard-parkins", Firstname = "richard", Surname = "parkins" } }); var consumer = new PactConsumer(_mockProviderServiceBaseUri); //Act var result = consumer.CreateUser("richard", "parkins").Result; //Assert Assert.EndsWith("/customers/richard-parkins", result.ToString()); _mockProviderService.VerifyInteractions(); }