Example #1
0
        public void TestMockedDelete()
        {
            var mockHandler = new MockHttpMessageHandler();

            mockHandler
            .Expect(HttpMethod.Delete, "http://127.0.0.1")
            .WithHeaders("Accept", "application/json")
            .Respond("text/plain", "DELETE OK");
            var client = new corerestclient.RestClient(mockHandler);
            var result = client.Delete("http://127.0.0.1");

            Assert.True(result.Contains("DELETE OK"));
            mockHandler.VerifyNoOutstandingExpectation();
        }
Example #2
0
        public void TestMockedDeleteWithOtherAuthAndContentType()
        {
            var mockHandler = new MockHttpMessageHandler();

            mockHandler
            .Expect(HttpMethod.Delete, "http://127.0.0.1")
            .WithHeaders("Accept", "text/plain")
            .WithHeaders("Authorization", "Basic basicAuthUser:basicAuthPassword")
            .Respond("text/plain", "DELETE OK");
            var client = new corerestclient.RestClient("Basic", "basicAuthUser:basicAuthPassword", "text/plain", mockHandler);
            var result = client.Delete("http://127.0.0.1");

            Assert.True(result.Contains("DELETE OK"));
            mockHandler.VerifyNoOutstandingExpectation();
        }