Exemplo n.º 1
0
        public void EndToEndTest()
        {
            const string buildUrl = "http://localhost:5000/";

            byte[] expected;
            byte[] actual;

            var restClient = new HttpRestClient("https://www.google.com");


            var routing = new RoutingRestClient
            {
                DefaultRestClient = restClient,
                RoutingAction     = null
            };

            using (var service = new Server(buildUrl, routing))
            {
                var request  = TestMother.BuildRequest();
                var response = restClient.GetResponseAsync(request).Result;

                expected = response.Data;

                request        = TestMother.BuildRequest();
                request.Server = buildUrl;
                response       = restClient.GetResponseAsync(request).Result;

                actual = response.Data;
            }

            Assert.IsNotNull(expected);
            Assert.IsTrue(expected.Length > 100);
        }
Exemplo n.º 2
0
        public void RoutingRestClientRequest()
        {
            var sut = new RoutingRestClient
            {
                DefaultRestClient = new HttpRestClient("https://www.google.com")
            };
            //sut.RoutingAction = p => sut.DefaultRestClient;

            var request = TestMother.BuildRequest();

            var response = sut.GetResponseAsync(request).Result;

            Assert.IsTrue(response.Data.Length > 0);
        }
Exemplo n.º 3
0
        public Server Build()
        {
            var restClient = new RoutingRestClient();

            return(new Server(_baseUrl, restClient));
        }