public void EfCore_Get_With_Selector_Selects_Only_Specified_Columns() { var repository = new EfCoreRepository <EmailAddress, int>(dbContext2); var emailAddress = repository.Find(m => m.Email == "*****@*****.**", s => new { s.ContactId, s.EmailAddressId, s.Email }); emailAddress.Email.ShouldBe("*****@*****.**"); dbContext2.QueryLog.Count(filterSelects).ShouldBe(1, "One SELECT must be executed"); string queryLogElement = dbContext2.QueryLog.Where(filterSelects).First(); Regex regex = new Regex("SELECT(.+)FROM.+", RegexOptions.IgnoreCase | RegexOptions.Singleline); var selectMatches = regex.Matches(queryLogElement); selectMatches.Count.ShouldBe(1, "One regex match must be found for the select pattern"); var selectPart = selectMatches[0].Groups[1].Value; selectPart.ShouldContain(nameof(EmailAddress.ContactId), "ContactId was selected"); selectPart.ShouldContain(nameof(EmailAddress.EmailAddressId), "EmailAddressId was selected"); selectPart.ShouldContain(nameof(EmailAddress.Email), "Email was selected"); selectPart.ShouldNotContain(nameof(EmailAddress.Label), "Label was not selected"); }