public void ExistingEntitiesShouldBeSelectedOnSingleKey() { using (var db = new UnitTestsContext()) { var now = DateTime.Now; // Save 200 numbers (1 to 200) to the database. var numbers = GenerateNumbers(1, 200, now).ToArray(); db.BulkInsertAll(new BulkInsertRequest <Number> { Entities = numbers, EnableRecursiveInsert = EnableRecursiveInsert.Yes }); // Create a list of 100 numbers with values 151 to 250 var nums = GenerateNumbers(151, 100, now) .Select(n => new Num { Val = n.Value }) .ToList(); // Numbers 151 to 200 from the database should be selected. var existingNumbers = db.BulkSelect <Num, Number>(new BulkSelectRequest <Num> { Items = nums.ToArray(), KeyPropertyMappings = new[] { new KeyPropertyMapping { ItemPropertyName = "Val", EntityPropertyName = "Value" }, } }).ToArray(); Assert.AreEqual(existingNumbers.Length, 50); var expectedNumbers = numbers.Skip(150).Take(50).ToArray(); for (int i = 0; i < 50; i++) { Assert.AreEqual(expectedNumbers[i].Id, existingNumbers[i].Id); Assert.AreEqual(expectedNumbers[i].ParityId, existingNumbers[i].ParityId); Assert.AreEqual(expectedNumbers[i].UpdatedAt.ToString(CultureInfo.InvariantCulture), existingNumbers[i].UpdatedAt.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(expectedNumbers[i].UpdatedBy, existingNumbers[i].UpdatedBy); Assert.AreEqual(expectedNumbers[i].Value, existingNumbers[i].Value); } } }