title: Mock OData Client's Container using Moq
body: <p>I am using OData V4 client to create proxy inside my asp.net mvc 5. I want to unit test the controllers using Moq. Is there any way I can mock the OData service response by container. Below is the OData container instantiator:</p>
  
  <pre><code>    public static class ControlEntityContextHelper
      {
           /// &lt;summary&gt;
           /// Returns OData service context
           /// &lt;/summary&gt;
           /// &lt;returns&gt;&lt;/returns&gt;
           public static Container GetEntityContext()
           {
               // create the container
               var container = new Container(new Uri("http://localhost/services/odata/"));
               container.Timeout = 1800;
               return container;
            }
       } 
  </code></pre>
  
  <p>Below is the MVC Controller:</p>
  
  <pre><code>    public JsonResult GetEmployees(string employeeId)
      {
          var odataContext = ControlEntityContextHelper.GetEntityContext();
          var employee = odataContext.Employees.Where(emp =&gt; emp.EmployeeId == employeeId);
          return Json(employee, JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>Any help will be greatly appreciated.</p>