public void TestMockedPatch() { var mockHandler = new MockHttpMessageHandler(); mockHandler .Expect("http://127.0.0.1") .WithHeaders("Accept", "application/json") .WithContent("PATCH CONTENT") .Respond("text/plain", "PATCH OK"); var client = new corerestclient.RestClient(mockHandler); var result = client.Patch("http://127.0.0.1", "PATCH CONTENT"); Assert.True(result.Contains("PATCH OK")); mockHandler.VerifyNoOutstandingExpectation(); }
public void TestMockedPatchWithOtherAuthAndContentType() { var mockHandler = new MockHttpMessageHandler(); mockHandler .Expect("http://127.0.0.1") .WithHeaders("Accept", "text/plain") .WithHeaders("Authorization", "Basic basicAuthUser:basicAuthPassword") .WithContent("PATCH CONTENT") .Respond("text/plain", "PATCH OK"); var client = new corerestclient.RestClient("Basic", "basicAuthUser:basicAuthPassword", "text/plain", mockHandler); var result = client.Patch("http://127.0.0.1", "PATCH CONTENT"); Assert.True(result.Contains("PATCH OK")); mockHandler.VerifyNoOutstandingExpectation(); }