Moq: How to retrieve ID of mocked object
<p>I have successfully created a mocked <code>Person</code> object and I am now trying to use my <code>AddChild()</code> method to add a child to the object via its' Id. My test looks like this:</p>

<pre><code>public class PersonManagerMockTest
{
    private static Guid personGuid;

    [ClassInitialize]
    public static void Init(TestContext test)
    {
        personGuid = Guid.NewGuid();
    }

    [TestMethod]
    public void AddNewPerson()
    {
        //Arrange
        var mockDbSet = new Mock&lt;DbSet&lt;Person&gt;&gt;();
        mockDbSet.Setup(x =&gt; x.Add(It.IsAny&lt;Person&gt;()))
            .Returns&lt;Person&gt;(p =&gt; p);

        var mockContext = new Mock&lt;IHiveTiesContext&gt;();
        mockContext.Setup(x =&gt; x.People)
            .Returns(mockDbSet.Object);
        var manager = new Manager(mockContext.Object);

        //Assert
        var _person = manager.CreatePerson("Winston", "Gabriel", DateTime.Now, 'M', personGuid);

        var fatherid = mockDbSet.Object.SingleOrDefault(x =&gt; x.RowId == personGuid).Id;
        manager.AddChild(new Person
        {
            FirstName = "Aaron",
            LastName = "Gabriel",
            DOB = new DateTime(1991, 01, 16),
            FavoriteColor = "Red",
            FatherId = fatherid,
        });

        //Act
        mockDbSet.Verify(x =&gt; x.Add(It.IsAny&lt;Person&gt;()), Times.Once);
        mockContext.Verify(x =&gt; x.SaveChanges(), Times.Once);
    }
}
</code></pre>

<p>The mocked <code>Person</code> object is successfully created, but the problem comes from this statement:</p>

<pre><code>var fatherid = mockDbSet.Object.SingleOrDefault(x =&gt; x.RowId == personGuid).Id;
</code></pre>

<p>I am not sure how to retrieve the <code>Id</code> from the mocked <code>Person</code> object, and as I thought this statement returned <code>0</code> for <code>fatherid</code> meaning that it is <code>null</code>. This is my first time running mocks, so I am still learning. Any suggestions on how to retrieve the <code>Id</code> from this mocked <code>Person</code> object? 
I will appreciate all suggestions. Thank you.</p>