public void GivenATest_TheContractGeneratorCreatesAFile() { var tempDir = $"../../../pacts/{Guid.NewGuid().ToString()}"; var config = new ConcordGeneratorConfig() { ContractDirectory = tempDir }; var gen = new ConcordGenerator(config); gen.ServiceConsumer("consumer1").HasContractWith("provider1"); var mockSvc = gen.MockService(4099); mockSvc.Given("A Test").UponReceiving("Some Scenario").With(new ContractRequest() { Url = "/abcd", Method = "GET" }).WillRespondWith(new ContractResponse() { StatusCode = HttpStatusCode.OK }); gen.Generate(); var lines = File.ReadAllText(tempDir + "/consumer1-provider1.json"); var obj = JsonConvert.DeserializeObject <ContractDefinition>(lines); Assert.That(obj.GetType() == typeof(ContractDefinition)); CleanUpDirectory(tempDir); }
public ExampleApiFixture() { var config = new ConcordGeneratorConfig { ContractDirectory = "../../..//pacts" }; ConcordGenerator = new ConcordGenerator(config); ConcordGenerator.ServiceConsumer("ConsumerApi").HasContractWith("ExampleApi"); MockProviderService = ConcordGenerator.MockService(port); }
public void Dispose() { ConcordGenerator.Generate(); }