I'm currently trying to get one of my unit tests to work, but there is one thing in the way. I have a class called AccountingScheduleLookup that has an ID field attached to it that's read-only. When I try to mock a call to a method that uses this ID field it throws me a lovely NullReferenceException on that particular line of code. This means that either the ID was not assigned to it, or the object was not instantiated.
When I did put in a basic instantiation, though, it still threw me the exception. Any ideas for how to get around this?
Here's a code sample (for what it's worth)
AccountingScheduleLookup = new AccountingSchedule { Description = "Will this work?" }
var calendarPeriods = dal.GetObjects<AccountingScheduleDetail>(
Where.Property("AccountingScheduleID").Is(AccountingScheduleLookup.AccountingScheduleID));