public IActionResult Update(string id) { ServiceProxy proxy = new ServiceProxy(); Customer data = proxy.Get(id); return(View(data)); }
public async Task TestGetWithCustomInitOptionsAndServiceOptions() { var initServiceOptions = new InitServiceOptions(_server.Ports.First(), Protocol.Http, new Dictionary <string, string> { { "foo", "bar" } }, "one"); _sut = new ServiceProxy(new Dictionary <string, string>(), "localhost", initServiceOptions); _server .Given(Request.Create() .WithPath("/one/two/foo") .WithHeader("foo", "bar") .WithHeader("baz", "bam") .UsingGet()) .RespondWith( Response.Create() .WithStatusCode(SUCCESS_STATUS_CODE) .WithBody(SUCCESS_RESPONSE_BODY) ); var response = await _sut.Get("foo", "", "", new ServiceOptions(_server.Ports.First(), Protocol.Http, new Dictionary <string, string> { { "baz", "bam" } }, "two")); var statusCode = (int)response.StatusCode; var responseBody = await response.Content.ReadAsStringAsync(); Check.That(statusCode).IsEqualTo(SUCCESS_STATUS_CODE); Check.That(responseBody).IsEqualTo(SUCCESS_RESPONSE_BODY); }
public IActionResult Index() { ServiceProxy proxy = new ServiceProxy(); List <Customer> data = proxy.Get(); return(View(data)); }
public async Task TestGetWithQueryAndOptions() { var port = _server.Ports.First(); var initServiceOptions = new InitServiceOptions(port); _sut = new ServiceProxy(new Dictionary <string, string>(), "localhost", initServiceOptions); _server .Given(Request.Create().WithPath("/foo").WithParam("bar", "baz").UsingGet()) .RespondWith( Response.Create() .WithStatusCode(SUCCESS_STATUS_CODE) .WithBody(SUCCESS_RESPONSE_BODY) ); var headers = new Dictionary <string, string> { { "foo", "bar" } }; var response = await _sut.Get("foo", "bar=baz", "", new ServiceOptions(port, Protocol.Http, headers)); var statusCode = (int)response.StatusCode; var responseBody = await response.Content.ReadAsStringAsync(); Check.That(response.RequestMessage.Headers.GetValues("foo").First()).IsEqualTo("bar"); Check.That(statusCode).IsEqualTo(SUCCESS_STATUS_CODE); Check.That(responseBody).IsEqualTo(SUCCESS_RESPONSE_BODY); }
private static string GetUserInformation(ApplicationConfig appConfig, GameJoltUserProxy proxy, ServiceProxy service) { var task = service.Get(proxy.GetUsers(appConfig.GameId, appConfig.PrivateKey, "runewake2")); task.Wait(); return(task.Result); }
public ActionResult Proxy() { ServiceProxy p = new ServiceProxy(); Customer c = p.Get("1"); return(View()); }
public void Get_ValidGETRequestDataSupplied_SendRequestSendMethodIsCalled() { var proxy = new ServiceProxy(_cloudId, _accessKey, _secretKey, _apiHost, new ServiceProxyUtility(), _serviceRequest); proxy.Get("videos.json", new Dictionary <string, string> { { "some_parameter", "some_value" }, { "another_parameter", "another_value" } }); _serviceRequest.AssertWasCalled(req => req.Send()); }
public async Task TestGet() { var initServiceOptions = new InitServiceOptions(_server.Ports.First()); _sut = new ServiceProxy(new Dictionary <string, string>(), "localhost", initServiceOptions); _server .Given(Request.Create().WithPath("/foo").UsingGet()) .RespondWith( Response.Create() .WithStatusCode(SUCCESS_STATUS_CODE) .WithBody(SUCCESS_RESPONSE_BODY) ); var response = await _sut.Get("foo"); var statusCode = (int)response.StatusCode; var responseBody = await response.Content.ReadAsStringAsync(); Check.That(statusCode).IsEqualTo(SUCCESS_STATUS_CODE); Check.That(responseBody).IsEqualTo(SUCCESS_RESPONSE_BODY); }