public async Task GetBySearchCriteriaAsyncShouldWorkCorrectlyWithMiddleName() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options; var dbContext = new ApplicationDbContext(options); var userRepo = new EfDeletableEntityRepository <ApplicationUser>(dbContext); var service = new EmployeesService(userRepo); await userRepo.AddAsync(new ApplicationUser { FirstName = "ivan", LastName = "ivanov", MiddleName = "ivanov", EGN = "1234567890", }); await userRepo.SaveChangesAsync(); var model = new EmployeeSearchModel { MiddleName = "ivanov", }; var customers = await service.GetBySearchCriteriaAsync <EmployeeModel, EmployeeSearchModel>(model); Assert.Single(customers); Assert.Collection( customers, x => Assert.Equal("ivanov", x.MiddleName)); }