title: facing issue while tring to fake method in class
body: <p>Here is my controller test class method which will initialize fake class</p>
  
  <pre><code>public void InitializeFake()
  {
      fakeHttpSession = A.Fake&lt;HttpSessionStateBase&gt;();
      fakeHttpContext = A.Fake&lt;HttpContextBase&gt;();
      nmsFake = A.Fake&lt;INMSPlatformClient&gt;();
  
      isFakeInitialized = true;
      fakeHttpSession.Contents["NMCSession"] = new NMCSession()
      {
          DefaultOrganizationUID = 1,
          FirstName = "system",
          Login = "sys.admin",
          LastName = "Admin",
          IsMultiAccountViewable = true,
          OrganizationUID = 1,
          OrganizationName = "NMC",
      };
  
  
     var fake = (NMCSession)fakeHttpSession.Contents["NMCSession"];
  
      A.CallTo(() =&gt; fakeHttpContext.Session).Returns(fakeHttpSession);
      A.CallTo(() =&gt; fakeHttpSession["NMCSession"]).Returns(fake);
      A.CallTo(() =&gt; fakeHttpContext.Session).Returns(fakeHttpSession);
      ControllerContext = new ControllerContext(fakeHttpContext, new RouteData(), A.Fake&lt;ControllerBase&gt;());
      myController = new PlatformOrganizationController(nmsFake);
      myController.ControllerContext = ControllerContext;
  }
  </code></pre>
  
  <p>here is my NMCSession class</p>
  
  <pre><code>public class NMCSession
  {
      private List&lt;Product&gt; m_products=null;
      public string Login { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public int OrganizationUID { get; set; }
      public string OrganizationName { get; set; }
      public string InstitutionCode { get; set; }
      public int DefaultOrganizationUID { get; set; }
  
      public string SessionToken { get; set; }
  
      public int UserUID { get; set; }
  
      public int NMCInactivityTimeOut { get; set; }
  
      public bool IsMultiAccountViewable { get; set; }
  
      public List&lt;Product&gt; GetProducts()
      {
         if(m_products!=null)
             return m_products;
         else
         {
             string NMSPlatformSvcUrl = System.Configuration.ConfigurationManager.AppSettings["NMSServerProtocol"] + "://" +
                                        System.Configuration.ConfigurationManager.AppSettings["NMSServerName"] + ":" +
                                        System.Configuration.ConfigurationManager.AppSettings["NMSServerPortNumber"];
              HttpClient httpClient = new HttpClient();
              httpClient.BaseAddress = new Uri(NMSPlatformSvcUrl);
              httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
              HttpResponseMessage response = httpClient.GetAsync("/NMS/Platform/ConfigurationSvc/v1/Status").Result;
              if (response.IsSuccessStatusCode)
              {
                  PlatformStatus status = response.Content.ReadAsAsync&lt;PlatformStatus&gt;().Result;
                  m_products=status.Products;
              }
              else
              {
                  throw new Exception(response.StatusCode.ToString());
              }
             rn m_products;
         }
      }
  
      public bool IsDevelopmentPartner { get; set; }
  }
  </code></pre>
  
  <p>Now the issue is at controller the user is to trying use the <code>NMCSession.GetProducts()</code> which is giving me exception.</p>
  
  <p>Now how can I fake the above <code>GetProducts()</code> method call in <code>NMCSession</code>?</p>