Vaibhav Singh

Vaibhav Singh

  • NA
  • 132
  • 20.9k

Mock a function using MOQ Framework that accepts a string an

Oct 13 2019 3:17 PM
We have an Interface called IEligibility containing a function called Eligibility
public virtual bool ConsiderAsEligible(string status)
{
bool isEligible = false;
if (status == "Confirmed" || status == "Fake")
{
isEligible = true;
}
return isEligible;
}
So with that said I wrote the below test case which is not working
[TestCase("Confirmed")]
public void Status_is_Confirmed_Then_Eligible(string status)
{
var Eligibility = new Mock<IEligibility>();
Eligibility.Setup(m => m.ConsiderAsEligible(status));
Assert.AreEqual(true, Eligibility .Object.ConsiderAsEligible(status));
}