I'm writing unit tests and using Moq as a mocking tool. In a previous question I was advised to use
IXdbContext to mock the XConnect client, which works just fine. However, I run into problems if I mock the
GetAsync() method to be able to get a
I need to get facets off of the returned
Contact so I either have to mock a
Contact and override the
GetFacet<>() method, or create a real
Contact instance with the proper facets in its
The first option fails because
Contact is sealed, and the second option fails because the
Facets collection is a
ReadOnlyDictionary which can't be written to.
So how can I properly mock a
Contact that I can return in
GetAsync() so that I can get facets out of it?