예제 #1
0
        public async void TestMethodCallWithCancellationToken()
        {
            var cancellationTokenSource = new CancellationTokenSource();

            cancellationTokenSource.Cancel();

            var      host        = "http://api.test.com";
            dynamic  test_client = new MockClient(host: host);
            Response response    = await test_client.get(cancellationToken : cancellationTokenSource.Token);
        }
예제 #2
0
        public async void TestMethodCall()
        {
            var      host        = "http://api.test.com";
            dynamic  test_client = new MockClient(host: host);
            Response response    = await test_client.get();

            Assert.IsNotNull(response);
            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            var content = new StringContent("{'test': 'test_content'}", Encoding.UTF8, "application/json");

            Assert.AreEqual(response.Body.ReadAsStringAsync().Result, content.ReadAsStringAsync().Result);
        }