public void MongoDbExtensions_EqualsIgnoreCase_Can_Create_RegEx_Filter_For_Case_Insensitive_Search() { var collection = _provider.GetDatabase().GetCollection <Well>(ObjectNames.Well141); AddParents(); var filter = Builders <Well> .Filter.Eq(ObjectTypes.Uid, Well.Uid.ToUpper()); var result = collection.Find(filter).ToList(); Assert.IsTrue(result.Count == 0); var regexFilter = MongoDbExtensions.EqualsIgnoreCase(Well.GetType(), ObjectTypes.Uid, Well.Uid.ToUpper()) as FilterDefinition <Well>; result = collection.Find(regexFilter).ToList(); Assert.IsTrue(result.Count == 1); Assert.AreEqual(Well.Name, result[0].Name); var regexFilterGeneric = MongoDbExtensions <Well> .EqualsIgnoreCase(ObjectTypes.Uid, Well.Uid.ToUpper()); result = collection.Find(regexFilterGeneric).ToList(); Assert.IsTrue(result.Count == 1); Assert.AreEqual(Well.Name, result[0].Name); var emptyFilter = MongoDbExtensions.EqualsIgnoreCase(Well.GetType(), ObjectTypes.Uid, string.Empty) as FilterDefinition <Well>; result = collection.Find(emptyFilter).ToList(); Assert.IsTrue(result.Count == 0); }