When writing Unit Tests for a function that is consuming a List<Microsoft.Bing.Speech.RecognitionPhrase>
I face the following error:
Invalid setup on a non-virtual (overridable in VB) member: x => x.Confidence
After reading here, I get that this is because the property is not virtual. I have been reading in the site about interfaces, wrappers, virtuals...but with no success.
I have access to RecognitionPhrase [from metadata]
and it has public Confidence Confidence { get; }
so there's no set
here. I have tried to create a public interface IRecognitionPhrase
and a public class RecognitionPhrase : IRecognitionPhrase
, but then in the final casting it says that it cannot cast my RecognitionPhrase to Microsoft.Bing.Speech.RecognitionPhrase.
I have read something about reflection but it seems to work with private setters rather than with no setters.
I'm out of ideas now. Any directions are much appreciated (and of course if someone has already mocked List<Microsoft.Bing.Speech.RecognitionPhrase>
please comment how did you do it) Thanks
I'm open to employing any other testing framework.