title: Check if a property was set - using Moq
body: <p>I am new to Moq and testing in general so here is my noobish Q.
  How do I test if the <strong>Status</strong> property on <strong>Request</strong> has been set using Moq?</p>
  
  <pre><code>public class DudeManager
  {
          private readonly IDRepository _repo;
  
          public DManager(IDRepository repo)
          {
              _repo = repo;
          }
  
          public void Create(Request r)
          {
              r.Status = Status.Submitted;
              _repo.AddRequest(r);
          }
  }
  </code></pre>
  
  <p>Is there a better approach than the following? Maybe using VerifySet?</p>
  
  <pre><code>        [TestMethod]
          public void AddingNewRequestSetsStatusToSubmitted()
          {
              //Arrange
              var mock = new Mock&lt;IDRepository&gt;();
              var mockRequest = new Mock&lt;Request&gt;();
              var dManager = new DManager(mock.Object);
  
              //Act
              dManager.Create(mockRequest.Object);
  
              //Assert
              Assert.AreEqual(Status.Submitted, mockRequest.Object.Status);
          }
  </code></pre>
  
  <p><strong>EDIT:</strong> This is the approach I ended up using after all the helpful suggestions:</p>
  
  <pre><code>//Arrange
  var request = new Request();
  var mock = new Mock&lt;IDRepository&gt;();
  var dManager = new DManager(mock.Object);
  mock.Setup(x =&gt; x.AddRequest(It.IsAny&lt;Request&gt;()));
  
  //Act
  dManager.QueueNewRequest(request);
  
  //Assert
  Assert.AreEqual(RequestStatus.Submitted, request.Status);
  </code></pre>
  
  <p>This approach seems right to me. Does anyone think otherwise?</p>