Was looking for ways to pull the lambda expressions I mock up....this way I could reuse them during the assertion portion of my test.
However when I pass the value in via a variable I get a test exception:
Telerik.JustMock.Core.MockException: The arranged function is not set up to return a value of type Account
Here is a sanitized version of what I'm trying to do?
public Interface IAccountManagement{
public Account GetAccount(string acctId);
}
........
public void MyTest()
{
IAccountManagement actMgrMock = Mock.Create<IAccountManagement>();
Account acct = TestHelpers.AutoGenerateAccount; //generate an acct object with Ploeh.AutoFixture
Expression<Action> GetAccount = () => actMgrMock.GetAccount(Arg.IsAny<string>());
//Mock.Arrange(GetAccount).Returns(e); //<------this call will not work when I invoke the test?
Mock.Arrange(() => actMgrMock.GetAccount(Arg.IsAny<string>())).Returns(e); // This one works?
// invoke
//Assert
//Mock.Assert(GetAccount,Occurs.Once());
}
However when I pass the value in via a variable I get a test exception:
Telerik.JustMock.Core.MockException: The arranged function is not set up to return a value of type Account
Here is a sanitized version of what I'm trying to do?
public Interface IAccountManagement{
public Account GetAccount(string acctId);
}
........
public void MyTest()
{
IAccountManagement actMgrMock = Mock.Create<IAccountManagement>();
Account acct = TestHelpers.AutoGenerateAccount; //generate an acct object with Ploeh.AutoFixture
Expression<Action> GetAccount = () => actMgrMock.GetAccount(Arg.IsAny<string>());
//Mock.Arrange(GetAccount).Returns(e); //<------this call will not work when I invoke the test?
Mock.Arrange(() => actMgrMock.GetAccount(Arg.IsAny<string>())).Returns(e); // This one works?
// invoke
//Assert
//Mock.Assert(GetAccount,Occurs.Once());
}