title: C# Moq VerifySet throws Expression is not a property setter invocation for non-trivial setter
body: <p>In C#, Moq VerifySet is throwing <code>Expression is not a property setter invocation.</code> when the setter is non-trivial, even when using SetupProperty or SetupSet.</p>
  
  <p>Here is a trivial example.  Notice that the Antlers setter is trivial and the Antlers2 setter is not trivial.:</p>
  
  <pre><code>public class Dancer
  {
  
      public Dancer(bool pIsMale)
      {
          IsMale = pIsMale;
      }
  
      private bool _IsMale;
      public virtual bool IsMale { get { return this._IsMale; } private set { this._IsMale = value; } }
  
      private bool _Antlers;
      public virtual bool Antlers
      {
          get { return this._Antlers; }
          set
          {
              this._Antlers = value;
          }
      }
  
      public virtual bool Antlers2
      {
          get { return this._Antlers; }
          set
          {
              // females cannot have antlers
              if (IsMale)
                  this._Antlers = value;
              else
                  this._Antlers = false;
          }
      }
  }
  </code></pre>
  
  <p>Here are the unit tests.  Second set of three (using Antlers2) are otherwise identical to the first set of three (using Antlers). All of the unit tests using Antlers passes the test. All unit tests using Antlers2 throw <code>Expression is not a property setter invocation.</code>, even when using SetupProperty where I thought the entirety of the property's implementation is completely ignored and replaced by Moq.</p>
  
  <pre><code>public class DancerTests
  {
      [Fact]
      public void Antlers_NoSetup()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
  
          // Act
          sut.Object.Antlers = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers = true);
      }
  
      [Fact]
      public void Antlers_SetupProperty()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
          sut.SetupProperty(x =&gt; x.Antlers, false);
  
          // Act
          sut.Object.Antlers = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers = true);
      }
  
      [Fact]
      public void Antlers_SetupSet()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
          sut.SetupSet(x =&gt; x.Antlers = true);
  
          // Act
          sut.Object.Antlers = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers = true);
      }
  
      [Fact]
      public void Antlers2_NoSetup()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
  
          // Act
          sut.Object.Antlers2 = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers2 = true);
      }
  
      [Fact]
      public void Antlers2_SetupProperty()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
          sut.SetupProperty(x =&gt; x.Antlers2, false);
  
          // Act
          sut.Object.Antlers2 = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers2 = true);
      }
  
      [Fact]
      public void Antlers2_SetupSet()
      {
          // Arrange
  
          // create mock of class under test
          var sut = new Mock&lt;Dancer&gt;(true) { CallBase = true };
          sut.SetupSet(x =&gt; x.Antlers2 = true);
  
          // Act
          sut.Object.Antlers2 = true;
  
          // Assert
          sut.VerifySet(x =&gt; x.Antlers2 = true);
      }
  
  }
  </code></pre>
  
  <p>What is it about non-trivial base class property setters that confuse Moq's VerifySet?  I am using Moq 4.7.99, Visual Studio 2015, targeting .Net Framework 4.5.2.</p>
  
  <p>Thanks for the help!  I have benefited greatly from StackOverflow!</p>