Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     ConcordGenerator.Generate();
 }