Following is the code for which I want to write unit tests:
public virtual ActionResult TryIt()
{
MemberViewModel viewModel = new MemberViewModel();
_memberViewModelLookupBuilder.PopulateSelectLists(viewModel);
return View(viewModel);
}
I want to write unit tests to fake the MemberViewModel object so that I can write tests for rest of the operations in action. Something like -
A.CallTo(() => viewModel = new TryItViewModel()).Returns(viewModel);
But this doesn't work and gives an error saying
"An expression tree may not contain an assignment operator"
Can anyone please advice how I can achieve this?
I am using xUnit and FakeItEasy in my test project.
Any help on this much appreciated.