public class IsMatchTests : Linq3IntegrationTest
|
{
|
[Fact]
|
public void Regex_IsMatch()
|
{
|
var collection = CreateCollection();
|
|
var query = collection.AsQueryable()
|
.Where(i => Regex.IsMatch((string)i.A, @"\dB.*", RegexOptions.ECMAScript));
|
|
var results = query.ToList();
|
|
results.Should().OnlyContain(i => Regex.IsMatch(i.A, @"\dB.*", RegexOptions.ECMAScript));
|
}
|
|
private IMongoCollection<Data> CreateCollection()
|
{
|
var collection = GetCollection<Data>("test");
|
CreateCollection(
|
collection,
|
new Data { Id = 1, A = "ABC" },
|
new Data { Id = 2, A = "1Br" });
|
return collection;
|
}
|
|
private class Data
|
{
|
public int Id { get; set; }
|
public string A { get; set; }
|
}
|
}
|