title: Mocking WebOperationContext.IncomingRequest
body: <p>I need to mock the WebOperationContext and specifically the IncomingRequest with a header that assigns the Accept value, as to test that the value is being read properly and the OutgoingReponse.ContentType matches that the desired format.  I'm using WCFMock and all was well with the general testing, but I can't get my head around what I need to do to mock the Incoming Response.</p>
  
  <p>The Accept property is readonly so assigning is directly can't happen.  I've tried adding the setter to WCFMock.IncomingWebRequestContextWrapper which predictably bombs since it's inheriting from System.SericeModel.Web.IncomingWebRequestContext.</p>
  
  <p>So something like this would be desired</p>
  
  <pre><code>[Test]
  public void SerializeObjectToXMLTest()
  {
      var fake = new FakeRest();
  
          var mockContext = new Mock&lt;IWebOperationContext&gt; { DefaultValue = DefaultValue.Mock };
  
          using (new MockedWebOperationContext(mockContext.Object))
          {
              // WHAT I WOULD LOVE:
               MockedWebOperationContext.Current.IncomingRequest.Accept = "application/json";
  
              fake.SetResponseContentType();
          }
  
          // Assert
          mockContext.VerifySet(c =&gt; c.OutgoingResponse.ContentType, "application/json");
  </code></pre>
  
  <p>}</p>
  
  <p>I'm afraid I have to totally mock a WebRequest and I'm looking to avoid that if possible.  </p>