Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra tests for camel casing and where clauses, addressed issue w/ Co… #3467

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/LinqTests/Acceptance/Support/DefaultQueryFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ public class DefaultQueryFixture: TargetSchemaFixture
{
public DefaultQueryFixture()
{
Store = provisionStore("linq_querying");
Store = ProvisionStore("linq_querying");


DuplicatedFieldStore = provisionStore("duplicate_fields", o =>
DuplicatedFieldStore = ProvisionStore("duplicate_fields", o =>
{
o.Schema.For<Target>()
.Duplicate(x => x.Number)
Expand All @@ -25,7 +25,7 @@ public DefaultQueryFixture()
.Duplicate(x => x.NumberArray);
});

SystemTextJsonStore = provisionStore("stj", o =>
SystemTextJsonStore = ProvisionStore("stj", o =>
{
o.Serializer<SystemTextJsonSerializer>();
});
Expand Down
4 changes: 2 additions & 2 deletions src/LinqTests/Acceptance/Support/TargetSchemaFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Dispose()
}
}

protected DocumentStore provisionStore(string schema, Action<StoreOptions> configure = null)
internal DocumentStore ProvisionStore(string schema, Action<StoreOptions> configure = null)
{
var store = DocumentStore.For(x =>
{
Expand All @@ -39,4 +39,4 @@ protected DocumentStore provisionStore(string schema, Action<StoreOptions> confi

return store;
}
}
}
10 changes: 10 additions & 0 deletions src/LinqTests/Acceptance/child_collection_queries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ public Task run_query(string description)
return assertTestCase(description, Fixture.Store);
}

[Theory]
[MemberData(nameof(GetDescriptions))]
public Task run_query_with_camel_casing(string description)
{
var store = Fixture.ProvisionStore("linq_with_camel_casing",
opts => opts.UseSystemTextJsonForSerialization(casing: Casing.CamelCase));

return assertTestCase(description, store);
}


[Theory]
[MemberData(nameof(GetDescriptions))]
Expand Down
4 changes: 3 additions & 1 deletion src/Marten/Linq/SqlGeneration/Filters/CollectionIsEmpty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ internal class CollectionIsEmpty: IReversibleWhereFragment
public CollectionIsEmpty(ICollectionMember member)
{
_member = member;
_text = $"d.data @? '$ ? (@.{member.MemberName} == null || @.{member.MemberName}.size() == 0)'";
// deeply ashamed by the replace here, but it does work.
var jsonPath = member.WriteJsonPath().Replace("[*]", "");
_text = $"d.data @? '$ ? (@.{jsonPath} == null || @.{jsonPath}.size() == 0)'";
}

public ISqlFragment Reverse()
Expand Down
Loading