0

Please refer the below code.

Method signature in the Interface

OrganizationVM GetParty(int param1, int param2, int param3);

Test method

[TestMethod]
public void GetOrganizationByPartyRoleId()
    {
        int param1 = 1;int param2 = 1;int param3 = 1;
        OrganizationVM org = this.MockManager.GetParty(param1, param2, param3);
        Assert.IsNotNull(org);
    }

Test project's constructor

int partyId = 2;
mockPartyManager.Setup(mr => mr.GetParty(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())).Returns((int i) => organizationList.Where(x => x.partyID == i).Single());

This throws

Parameter count mismatch. exception. How to solve this issue.

Harsha W
  • 3,162
  • 5
  • 43
  • 77

1 Answers1

2

You have GetParty(int param1, int param2, int param3) with 3 parameters, but in Returns call you are using only one. Change it to something like this

.Returns((int i, int j, int k) => organizationList.Where(x => x.partyID == i).Single());
Jevgenij Nekrasov
  • 2,690
  • 3
  • 30
  • 51