MOQ questions often get people pointing back to the documents , which is cool and all but I think I need some help understanding what this error comes from ( maybe my knowledge of lambda expressions is off )
I have a MOQ test
var mockTicket = new Mock<Ticket>();
mockTicket.Setup(tix => tix.Total).Returns(var expectedResult = 5);
cashRegister.PendingTickets.Add(mockTicket.Object);
//act
var actual = cashRegister.CloseTicket(mockTicket.Object);
// FYI . close ticket returns the total of the tickets hence this is logical to the point that the
// ticket is the price being returned.
//assert
Assert.Equals(actual, expectedResult);
and my errors are
System.NotSupportedException: Invalid setup on a non-virtual (overridable in VB) member: tix => tix.Total
and also Total is just a get
public decimal Total
{
get
{
return Decimal.Round(ItemsOrdered.Sum(x => x.Price + x.Tax), 2);
}
}