I keep getting the "Unsupported expression" exception. It seems that the lambda expression (a=>a.PP_EventID==1) is the problem. How do solved this one?
pricepackPersistenceMock.Setup(pricepack => pricepack.Delete(a=>a.PP_EventID==1)).Verifiable();
I keep getting the "Unsupported expression" exception. It seems that the lambda expression (a=>a.PP_EventID==1) is the problem. How do solved this one?
pricepackPersistenceMock.Setup(pricepack => pricepack.Delete(a=>a.PP_EventID==1)).Verifiable();
You should use the predicate inside It.Is<T>()
method.
pricepackPersistenceMock.Setup(pricepack => ricepack.Delete(It.Is<TypeOfa>(a=>a.PP_EventID==1)))
.Verifiable();
Update:
eventPersistenceMock.Setup(u => u.Single(It.IsAny<Func<tbl_SBAem_Event, bool>>()))
.Returns(eventlists.Where(a => a.EventMngID == currentevent.EventMngID).Single());
// you can directly return the value
//verifiable is not needed because you set the return value