Skip to content

Commit 4e2bde2

Browse files
committed
Refactor ExpressiveMongoQueryable and MongoContainerFixture for improved readability and functionality
1 parent 2613106 commit 4e2bde2

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/ExpressiveSharp.MongoDB/Infrastructure/ExpressiveMongoQueryable.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ public ExpressiveMongoQueryable(IQueryable<T> source, ExpressiveMongoQueryProvid
3030
public Expression Expression => _source.Expression;
3131
public IQueryProvider Provider => _provider;
3232

33-
public IEnumerator<T> GetEnumerator() => _source.GetEnumerator();
34-
IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)_source).GetEnumerator();
33+
public IEnumerator<T> GetEnumerator()
34+
=> _provider.Execute<IEnumerable<T>>(Expression).GetEnumerator();
35+
36+
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
3537

3638
public IAsyncCursor<T> ToCursor(CancellationToken cancellationToken = default)
3739
=> ((IAsyncCursorSource<T>)ExpandedInnerQueryable()).ToCursor(cancellationToken);

tests/ExpressiveSharp.MongoDB.IntegrationTests/Infrastructure/MongoContainerFixture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ private static bool DetectDocker()
3737
{
3838
try
3939
{
40-
using var client = new Docker.DotNet.DockerClientConfiguration().CreateClient();
40+
using var config = new Docker.DotNet.DockerClientConfiguration();
41+
using var client = config.CreateClient();
4142
client.System.PingAsync().GetAwaiter().GetResult();
4243
return true;
4344
}

tests/ExpressiveSharp.MongoDB.IntegrationTests/Tests/ExpressiveMongoQueryProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Linq.Expressions;
2-
using ExpressiveSharp.Extensions;
32
using ExpressiveSharp.IntegrationTests.Scenarios.Store.Models;
3+
using ExpressiveSharp.MongoDB.Extensions;
44
using ExpressiveSharp.MongoDB.IntegrationTests.Infrastructure;
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66
using MongoDB.Driver;
@@ -9,7 +9,7 @@
99
namespace ExpressiveSharp.MongoDB.IntegrationTests.Tests;
1010

1111
/// <summary>
12-
/// Verifies that <see cref="Infrastructure.ExpressiveMongoQueryProvider"/> correctly
12+
/// Verifies that <see cref="ExpressiveMongoQueryProvider"/> correctly
1313
/// expands <c>[Expressive]</c> members before MongoDB's LINQ provider processes the query.
1414
/// </summary>
1515
[TestClass]

0 commit comments

Comments
 (0)