Exemple #1
0
        public void GivenAContractToBuild_ItIsInTheStore()
        {
            var mockProvider = new MockProviderService(port);

            mockProvider.Given("A Test").UponReceiving("A Request").With(new ContractRequest()
            {
                Method = "Get",
                Url    = "/1234"
            }).WillRespondWith(new ContractResponse()
            {
                StatusCode = HttpStatusCode.OK
            });
            var contractFromStore = mockProvider.GetContracts().FirstOrDefault(c => c.Name == "A Test");

            Assert.NotNull(contractFromStore);
            Assert.AreEqual("A Test", contractFromStore.Name);
            Assert.AreEqual("A Request", contractFromStore.Scenario);
            Assert.AreEqual("Get", contractFromStore.Request.Method);
            Assert.AreEqual("/1234", contractFromStore.Request.Url);
            Assert.AreEqual(HttpStatusCode.OK, contractFromStore.Response.StatusCode);
        }