Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -429,21 +429,6 @@ static SqlServerTypeMappingSource()
return base.FindCollectionMapping(info, modelType, providerType, elementMapping);
#pragma warning restore EF1001
}
// => TryFindJsonCollectionMapping(
// info.CoreTypeMappingInfo, modelType, providerType, ref elementMapping, out var comparer, out var collectionReaderWriter)
// ? (RelationalTypeMapping)FindMapping(
// info.WithConverter(
// // Note that the converter info is only used temporarily here and never creates an instance.
// new ValueConverterInfo(modelType, typeof(string), _ => null!)))!
// .WithComposedConverter(
// (ValueConverter)Activator.CreateInstance(
// typeof(CollectionToJsonStringConverter<>).MakeGenericType(
// modelType.TryGetElementType(typeof(IEnumerable<>))!), collectionReaderWriter!)!,
// comparer,
// comparer,
// elementMapping,
// collectionReaderWriter)
// : null;

private static readonly List<string> NameBasesUsingPrecision =
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,115 +14,98 @@ public OwnedNavigationsCollectionCosmosTest(OwnedNavigationsCosmosFixture fixtur
Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}

public override Task Count(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Count(a);

AssertSql(
"""
public override async Task Count()
{
await base.Count();

AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (ARRAY_LENGTH(c["RelatedCollection"]) = 2)
""");
});
}

public override Task Where(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Where(a);
public override async Task Where()
{
await base.Where();

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE ((
SELECT VALUE COUNT(1)
FROM r IN c["RelatedCollection"]
WHERE (r["Int"] != 8)) = 2)
""");
});
}

public override async Task OrderBy_ElementAt(bool async)
public override async Task OrderBy_ElementAt()
{
if (async)
{
// 'ORDER BY' is not supported in subqueries.
await Assert.ThrowsAsync<CosmosException>(() => base.OrderBy_ElementAt(async));
// 'ORDER BY' is not supported in subqueries.
await Assert.ThrowsAsync<CosmosException>(() => base.OrderBy_ElementAt());

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (ARRAY(
SELECT VALUE r["Int"]
FROM r IN c["RelatedCollection"]
ORDER BY r["Id"])[0] = 8)
""");
}
}

public override Task Index_constant(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Index_constant(a);
public override async Task Index_constant()
{
await base.Index_constant();

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RelatedCollection"][0]["Int"] = 8)
""");
});
}

public override Task Index_parameter(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Index_parameter(a);
public override async Task Index_parameter()
{
await base.Index_parameter();

AssertSql(
"""
AssertSql(
"""
@i=?

SELECT VALUE c
FROM root c
WHERE (c["RelatedCollection"][@i]["Int"] = 8)
""");
});
}

public override async Task Index_column(bool async)
public override async Task Index_column()
{
if (async)
{
// The specified query includes 'member indexer' which is currently not supported
await Assert.ThrowsAsync<CosmosException>(() => base.Index_column(async));
// The specified query includes 'member indexer' which is currently not supported
await Assert.ThrowsAsync<CosmosException>(() => base.Index_column());

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RelatedCollection"][(c["Id"] - 1)]["Int"] = 8)
""");
}
}

public override async Task Index_out_of_bounds(bool async)
public override async Task Index_out_of_bounds()
{
if (async)
{
await base.Index_out_of_bounds(async);
await base.Index_out_of_bounds();

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RelatedCollection"][9999]["Int"] = 8)
""");
}
}

[ConditionalFact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,41 @@ public OwnedNavigationsMiscellaneousCosmosTest(OwnedNavigationsCosmosFixture fix
Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper);
}

public override Task Where_related_property(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Where_related_property(a);

AssertSql(
"""
public override async Task Where_related_property()
{
await base.Where_related_property();

AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RequiredRelated"]["Int"] = 8)
""");
});
}

public override Task Where_optional_related_property(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Where_optional_related_property(a);
public override async Task Where_optional_related_property()
{
await base.Where_optional_related_property();

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["OptionalRelated"]["Int"] = 8)
""");
});
}

public override Task Where_nested_related_property(bool async)
=> Fixture.NoSyncTest(
async, async a =>
{
await base.Where_nested_related_property(a);
public override async Task Where_nested_related_property()
{
await base.Where_nested_related_property();

AssertSql(
"""
AssertSql(
"""
SELECT VALUE c
FROM root c
WHERE (c["RequiredRelated"]["RequiredNested"]["Int"] = 8)
""");
});
}

[ConditionalFact]
public virtual void Check_all_tests_overridden()
Expand Down
Loading