Ejemplo n.º 1
0
        public void CanSerializeAndDeserializePrimitiveTypes()
        {
            // first regen the spec
            SwaggerSpecRunner.RunTests(
                SwaggerPath("swagger-mirror-primitives.json"), ExpectedPath("Mirror.Primitives"));

            //Now run mocked tests using the client
            var product = MirrorTestHelpers.GenerateProduct();

            using (var client = MirrorTestHelpers.CreateDataClient())
            {
                var response = client.PutProduct("200", product);
                MirrorTestHelpers.ValidateProduct(product, response);
            }
        }
Ejemplo n.º 2
0
        public void UrlIsCorrectWhenBaseUriContainsSegment()
        {
            var product = MirrorTestHelpers.GenerateProduct();

            using (var content = new StringContent(""))
                using (var message = new HttpResponseMessage {
                    Content = content
                })
                    using (var handler = new RecordedDelegatingHandler(message))
                        using (var client = MirrorTestHelpers.CreateDataClient(handler))
                        {
                            client.BaseUri = new Uri("http://somesite/segment1/");
                            client.PutProduct("200", product);
                            Assert.Equal("http://somesite/segment1/datatypes", handler.Uri.AbsoluteUri);
                        }
        }