Trying to set up a function to moq a call to a db to return an object
The function I am trying to mock is
res = ReservationMongo.GetById<res.Reservation>(request.ReferenceNumber);
Which is defined as
T GetById<T>(object id, bool fixId = false);
However in my set up I am encountering this error:
an expression tree may not contain a call or invocation that uses optional arguments
My setup:
Mock <IMongoDBService> resMock = new Mock<IMongoDBService>();
resMock.Setup(x => x.GetById<Reservation>(request.ReferenceNumber)).Returns(res1);