Hi,
Im trying to test this statement
IStudentAssessmentUnitStatus res = student.UnitStatusList.OfType<IStudentAssessmentUnitStatus>().
FirstOrDefault(s => s.ID == unit.ID);
Inside the list there could be multiple types hence the OfType. However when testing it says "Object reference not set to an instance"
var _mockStudentFormUnit = _mockery.DynamicMock<IStudentAssessmentUnitStatus>();
var _mockStudentAssessmentUnit = _mockery.DynamicMock<IStudentFormUnitStatus>();
var studentunitList = new List<IStudentUnitStatus>() { _mockStudentFormUnit, _mockStudentAssessmentUnit };
var mockEnum2 = _mockery.DynamicMock<IEnumerable<IStudentUnitStatus>>();
Expect.Call(_mockStudent2.UnitStatusList).Return(mockEnum2).Repeat.Any();
Expect.Call(mockEnum2.GetEnumerator()).Return(null).WhenCalled(s => s.ReturnValue = studentunitList.GetEnumerator()).Repeat.Any();
Can any Rhino experts see what I have done wrong . The above works fine for enumerations and OfType technically should just do a foreach and perform an "is" operation
Thanks