public virtual void GetTests() { // // Test missing element // entityRepo.TruncateCollection(); Exception e = null; try { entityRepo.GetById("unknown_id"); } catch (Exception ex) { e = ex; } Assert.IsInstanceOfType(e, typeof(KeyNotFoundNoSQLException), "Getbyid sould raise IdNotFoundException for missing ids"); // // Test GetByIds // // Init test var entity1 = TestHelper.GetEntity1(); var entity2 = TestHelper.GetEntity2(); entityRepo.InsertOne(entity1); entityRepo.InsertOne(entity2); List <string> ids = new List <string>() { entity1.Id, entity2.Id, "unknown_id" }; var results = entityRepo.GetByIds(ids); Assert.AreEqual(2, results.Count(), "GetByIds should return 2 entities"); Assert.IsTrue(results.Any(i => i.Name.Equals("Balan"))); Assert.IsTrue(results.Any(i => i.Name.Equals("Mack"))); }