title: System.NotSupportedException: Unsupported expression: p => (p.UserProfileId == 1)
body: <p>I have a test that uses System.Func expressions. It should be pretty straight forward, but the test keeps on failing.</p>
  
  <p>Test:</p>
  
  <pre><code>  [TestMethod]
    public void GetUser()
    {
      var username = "john@resilientplc.com";
      var user = new User() { UserId = 1, Username = username, Password = "123456789" };
  
      someDataMock.Setup(s =&gt; s.GetUser(p =&gt; p.UserId == 1)).Returns(user);
  
      var result = userProfileModel.GetUser(user.UserId);
      Assert.AreEqual(user, result);
    }
  </code></pre>
  
  <p>Implementation <strong>UserProfileModel</strong>:</p>
  
  <pre><code>public User GetUser(long userId)
  {
    return someDataMock.GetUser(u =&gt; u.UserId == UserId);
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>System.NotSupportedException: Unsupported expression: p =>
    (p.UserId == 1)</p>
  </blockquote>
  
  <p>Any idea where my test is incorrect?</p>