Exemplo n.º 1
0
        public void Dispose()
        {
            var wiremockClient = new WiremockClient(GetConfigValue(KeyNameHelpers.WireMockUrlKeyString));
            var resetTask      = wiremockClient.ResetMappingsAsync();

            resetTask.Wait();
        }
Exemplo n.º 2
0
        public async Task GivenAMockedManufacturerExists()
        {
            var mockedManufactuer = new Manufacturer
            {
                id        = Guid.NewGuid().ToString(),
                name      = $"{Guid.NewGuid()}-Teslas",
                cars      = new List <string>(),
                createdBy = "",
                updatedBy = "",
            };

            var wiremockClient = new WiremockClient(GetConfigValue(KeyNameHelpers.WireMockUrlKeyString));
            await wiremockClient.MockEndpointAsync(new Mappings
            {
                request = new Request
                {
                    method = "GET",
                    url    = $"/manufacturer/{mockedManufactuer.id}"
                },
                response = new Response
                {
                    status   = 200,
                    jsonBody = mockedManufactuer,
                    headers  = new Dictionary <string, string> {
                        { "Content-Type", "application/json" }
                    }
                }
            });

            await wiremockClient.MockEndpointAsync(new Mappings
            {
                request = new Request
                {
                    method = "PATCH",
                    url    = $"/manufacturer/"
                },
                response = new Response
                {
                    status   = 200,
                    jsonBody = mockedManufactuer,
                    headers  = new Dictionary <string, string> {
                        { "Content-Type", "application/json" }
                    }
                }
            });

            AddObject(KeyNameHelpers.ExistingManufacturerKeyString, mockedManufactuer);
        }