hi mate, I was wondering if it is possible to mock the following case.
from school in dbContext.Schools
join student in dbContext.Students
on school.id equals student.schoolId into students
let firstStudent = students.FirstOrDefault()
select firstStudent.Name;
When all the tables are empty and there is no school and no student in the tables, a real sql execution just returns an empty object of IEnuemrable<string> type. If I mock 'dbContext.Schools' and 'dbContext.Students', 'firstStudent.Name' throws a null exception because 'firstStudent' is null.
Is there a way to conditionally mock only in this context of linq to sql so that we can bypass the null exception and get the mocked execution to run smoothly?