The operands for operator 'Equal' do not match the parameters of method 'op_Equality' when running a unit test with just mock

Viewed 1010

We are currently running this expression

return x => x.ObjectType != null && x.ObjectType == "SERVICE"
                        && x.Service.Id == searchValue;

Which works fine until we come to do a unit test with just mock and it fails with the following exception:

The operands for operator 'Equal' do not match the parameters of method 'op_Equality'

The part of the expression that fails is the null check. If I replace the expression with just the null check and do the following it fails:

_unitOfWork.Repository<Widgits, int>().FindAll(x => x.ObjectType != null);

Does anyone know why this would only cause a problem when Unit Testing?

0 Answers
Related