From 91e4db34fb467976eba68bcf66b77fb39113a862 Mon Sep 17 00:00:00 2001 From: BorisDog Date: Fri, 27 Mar 2026 13:14:10 -0700 Subject: [PATCH] - Update LINQ MQL to 3.7 --- .../Builders/BuildersConstantsReplacement.cs | 15 ++-- .../Linq/LinqNullables.cs | 72 ++++++++++++------- .../Linq/LinqQualifiedNames.cs | 6 +- .../Linq/NotSupportedLinqExpressions.cs | 9 ++- .../DriverVersions.cs | 3 + 5 files changed, 69 insertions(+), 36 deletions(-) diff --git a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersConstantsReplacement.cs b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersConstantsReplacement.cs index 955abbd2..13354b3d 100644 --- a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersConstantsReplacement.cs +++ b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Builders/BuildersConstantsReplacement.cs @@ -257,13 +257,14 @@ public void Methods_with_simple_type_parameters(int intParam, string stringParam } // VS-166 - [BuildersMQL("{ \"$or\" : [{ \"Nested.Nested.Nested.Nested.BsonType\" : BsonDocument.ElementCount }, { \"Nested.Nested.Nested.BsonDocument.ElementCount\" : BsonDocument.ElementCount }, { \"Nested.Nested.BsonDocument.ElementCount\" : GetBsonDocument().ElementCount }] }")] - public void Query_containing_bson_types() - { - _ = Builders.Filter.Eq(o => o.Nested.Nested.Nested.Nested.BsonType, BsonType.Double) | - Builders.Filter.Eq(o => o.Nested.Nested.Nested.BsonDocument.ElementCount, BsonDocument.ElementCount) | - Builders.Filter.Eq(o => o.Nested.Nested.BsonDocument.ElementCount, GetBsonDocument().ElementCount); - } + // Disabled due to CSHARP-5952 + // [BuildersMQL("{ \"$or\" : [{ \"Nested.Nested.Nested.Nested.BsonType\" : BsonDocument.ElementCount }, { \"Nested.Nested.Nested.BsonDocument.ElementCount\" : BsonDocument.ElementCount }, { \"Nested.Nested.BsonDocument.ElementCount\" : GetBsonDocument().ElementCount }] }")] + // public void Query_containing_bson_types() + // { + // _ = Builders.Filter.Eq(o => o.Nested.Nested.Nested.Nested.BsonType, BsonType.Double) | + // Builders.Filter.Eq(o => o.Nested.Nested.Nested.BsonDocument.ElementCount, BsonDocument.ElementCount) | + // Builders.Filter.Eq(o => o.Nested.Nested.BsonDocument.ElementCount, GetBsonDocument().ElementCount); + // } [BuildersMQL("{ \"$or\" : [{ \"Nested.Nested.Point.X\" : Point.Empty.X }, { \"Nested.Point.Y\" : 123 }, { \"Nested.Point.X\" : GetDrawingPoint().X }] }")] public void Query_containing_system_types() diff --git a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqNullables.cs b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqNullables.cs index 09ef7cb1..81ef83c6 100644 --- a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqNullables.cs +++ b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqNullables.cs @@ -24,7 +24,8 @@ namespace MongoDB.Analyzer.Tests.Common.TestCases.Linq public sealed class LinqNullables : TestCasesBase { [MQL("Aggregate([{ \"$match\" : { \"Vehicle.VehicleType.Type\" : GetVehicleTypeEnum() } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, GetNullableShort()] } } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, GetNullableShort()] } } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ShortNullable\" : GetNullableShort() } }])", DriverVersions.V3_7_OrGreater)] public void Method_with_nullable_return_type() { _ = GetMongoQueryable() @@ -35,7 +36,8 @@ public void Method_with_nullable_return_type() } [MQL("Aggregate([{ \"$match\" : { \"Vehicle.VehicleType.Type\" : GetVehicleTypeEnum() } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, GetNullableShort()] } } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, GetNullableShort()] } } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ShortNullable\" : GetNullableShort() } }])", DriverVersions.V3_7_OrGreater)] public void Method_with_nullable_return_type_with_query_syntax() { _ = from person in GetMongoQueryable() @@ -47,10 +49,14 @@ public void Method_with_nullable_return_type_with_query_syntax() select nullableHolder; } - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, nullableEnumInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, nullableEnumUInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, nullableEnumInt16] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, nullableEnumUInt16] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, 0] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, nullableEnumInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, nullableEnumUInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, nullableEnumInt16] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, nullableEnumUInt16] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, 0] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : nullableEnumInt8 }, { \"EnumUInt8\" : nullableEnumUInt8 }, { \"EnumInt16\" : nullableEnumInt16 }, { \"EnumUInt16\" : nullableEnumUInt16 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] public void Nullables_enum() { EnumInt8? nullableEnumInt8 = null; @@ -83,10 +89,14 @@ public void Nullables_enum() .Select(e => e.EnumInt16); } - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, nullableEnumInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, nullableEnumUInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, nullableEnumInt16] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, nullableEnumUInt16] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, 0] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, nullableEnumInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, nullableEnumUInt8] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, nullableEnumInt16] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, nullableEnumUInt16] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt8\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumInt16\" }, 0] } }, { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$EnumUInt16\" }, 0] } }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : nullableEnumInt8 }, { \"EnumUInt8\" : nullableEnumUInt8 }, { \"EnumInt16\" : nullableEnumInt16 }, { \"EnumUInt16\" : nullableEnumUInt16 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : nullableEnumInt32 }, { \"EnumUInt32\" : nullableEnumUInt32 }, { \"EnumInt64\" : nullableEnumInt64 }, { \"EnumUInt64\" : nullableEnumUInt64 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : null }, { \"EnumUInt8\" : null }, { \"EnumInt16\" : null }, { \"EnumUInt16\" : null }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : null }, { \"EnumUInt32\" : null }, { \"EnumInt64\" : null }, { \"EnumUInt64\" : null }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"$or\" : [{ \"EnumInt8\" : 0 }, { \"EnumUInt8\" : 0 }, { \"EnumInt16\" : 0 }, { \"EnumUInt16\" : 0 }] } }, { \"$match\" : { \"$or\" : [{ \"EnumInt32\" : 0 }, { \"EnumUInt32\" : 0 }, { \"EnumInt64\" : 0 }, { \"EnumUInt64\" : 0 }] } }, { \"$project\" : { \"_v\" : \"$EnumInt16\", \"_id\" : 0 } }])", DriverVersions.V3_7_OrGreater)] public void Nullables_enum_with_query_syntax() { EnumInt8? nullableEnumInt8 = null; @@ -133,13 +143,20 @@ public void Nullable_mongo_queryable_with_query_syntax() select new { person.Name, person.Address.City }; } - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, StaticHolder.ReadonlyByteNullable] } } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, StaticHolder.ReadonlyShortNullable] } } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])")] - [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])")] - [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, StaticHolder.ReadonlyByteNullable] } } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, StaticHolder.ReadonlyShortNullable] } } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : StaticHolder.ReadonlyByteNullable } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"ShortNullable\" : StaticHolder.ReadonlyShortNullable } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])", DriverVersions.V3_7_OrGreater)] public void Nullable_primitive_types() { _ = GetMongoQueryable() @@ -195,13 +212,20 @@ public void Nullable_primitive_types() .Where(p => p.Address.City == (string?)"City"); } - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, StaticHolder.ReadonlyByteNullable] } } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, StaticHolder.ReadonlyShortNullable] } } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])")] - [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])")] - [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])")] - [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, StaticHolder.ReadonlyByteNullable] } } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, StaticHolder.ReadonlyShortNullable] } } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, 1] } } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ShortNullable\" }, 2] } } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : StaticHolder.ReadonlyByteNullable } }, { \"$match\" : { \"DoubleNullable\" : StaticHolder.ReadonlyDoubleNullable } }, { \"$match\" : { \"IntNullable\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"LongNullable\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"ShortNullable\" : StaticHolder.ReadonlyShortNullable } }, { \"$match\" : { \"StringNullable\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : null } }, { \"$match\" : { \"DoubleNullable\" : null } }, { \"$match\" : { \"IntNullable\" : null } }, { \"$match\" : { \"LongNullable\" : null } }, { \"$match\" : { \"ShortNullable\" : null } }, { \"$match\" : { \"StringNullable\" : null } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : 1 } }, { \"$match\" : { \"DoubleNullable\" : 4.5 } }, { \"$match\" : { \"IntNullable\" : 21 } }, { \"$match\" : { \"LongNullable\" : 22 } }, { \"$match\" : { \"ShortNullable\" : 2 } }, { \"$match\" : { \"StringNullable\" : \"String\" } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : StaticHolder.ReadonlyIntNullable } }, { \"$match\" : { \"TicksSinceBirth\" : StaticHolder.ReadonlyLongNullable } }, { \"$match\" : { \"Name\" : StaticHolder.ReadonlyStringNullable } }, { \"$match\" : { \"Address.City\" : StaticHolder.ReadonlyStringNullable } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"SiblingsCount\" : 1 } }, { \"$match\" : { \"TicksSinceBirth\" : 2 } }, { \"$match\" : { \"Name\" : \"Name\" } }, { \"$match\" : { \"Address.City\" : \"City\" } }])", DriverVersions.V3_7_OrGreater)] public void Nullable_primitive_types_with_query_syntax() { _ = from nullableHolder in GetMongoQueryable() diff --git a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqQualifiedNames.cs b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqQualifiedNames.cs index e0c0ffeb..3df88ffb 100644 --- a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqQualifiedNames.cs +++ b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/LinqQualifiedNames.cs @@ -30,8 +30,10 @@ public sealed class LinqQualifiedNames : TestCasesBase [MQL("Aggregate([{ \"$match\" : { \"Age\" : 22 } }])")] [MQL("Aggregate([{ \"$match\" : { \"Age\" : 22 } }])")] [MQL("Aggregate([{ \"$match\" : { \"Age\" : 22 } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, common::DataModel.StaticHolder.ReadonlyByteNullable] } } }])")] - [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, dataModel::StaticHolder.ReadonlyByteNullable] } } }])")] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, common::DataModel.StaticHolder.ReadonlyByteNullable] } } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"$expr\" : { \"$eq\" : [{ \"$toInt\" : \"$ByteNullable\" }, dataModel::StaticHolder.ReadonlyByteNullable] } } }])", DriverVersions.V3_6_AndLower)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : common::DataModel.StaticHolder.ReadonlyByteNullable } }])", DriverVersions.V3_7_OrGreater)] + [MQL("Aggregate([{ \"$match\" : { \"ByteNullable\" : dataModel::StaticHolder.ReadonlyByteNullable } }])", DriverVersions.V3_7_OrGreater)] public void Qualified_alias() { _ = GetMongoQueryable().Where(user => user.Age == 22); diff --git a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/NotSupportedLinqExpressions.cs b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/NotSupportedLinqExpressions.cs index 28d45007..d01f2768 100644 --- a/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/NotSupportedLinqExpressions.cs +++ b/tests/MongoDB.Analyzer.Tests.Common.TestCases/Linq/NotSupportedLinqExpressions.cs @@ -29,7 +29,8 @@ where ReturnArgument(ReturnArgument(ReturnArgument(this).ReturnArgument(person.V } [InvalidLinq("Expression not supported: 10 in (o.BsonDocument.ElementCount == 10) because it was not possible to determine how to serialize the constant.", DriverVersions.V3_1_AndLower)] - [InvalidLinq("Expression not supported: o.BsonDocument.ElementCount.", DriverVersions.V3_2_OrGreater)] + [InvalidLinq("Expression not supported: o.BsonDocument.ElementCount.", DriverVersions.V3_2_to_3_6_OrGreater)] + [InvalidLinq("Serializer value type MongoDB.Bson.BsonValue is incompatible with expression value type System.Int32 (Parameter 'serializer')", DriverVersions.V3_7_OrGreater)] public void Unsupported_bson_types() { _ = GetMongoQueryable().Where(o => o.BsonDocument.ElementCount == 10); @@ -129,8 +130,10 @@ public void Unsupported_type_for_bson_attribute_argument() .Select(y => y); } - [InvalidLinq("Serializer for MongoDB.Analyzer.Tests.Common.DataModel.Fruit does not have a member named Quantity.")] - [InvalidLinq("Serializer for MongoDB.Analyzer.Tests.Common.DataModel.Apple does not have a member named _AppleID.")] + [InvalidLinq("Serializer for MongoDB.Analyzer.Tests.Common.DataModel.Fruit does not have a member named Quantity.", DriverVersions.V3_6_AndLower)] + [InvalidLinq("Serializer for MongoDB.Analyzer.Tests.Common.DataModel.Apple does not have a member named _AppleID.", DriverVersions.V3_6_AndLower)] + [InvalidLinq("Expression not supported: f.Quantity because serializer for MongoDB.Analyzer.Tests.Common.DataModel.Fruit does not have a member named Quantity..", DriverVersions.V3_7_OrGreater)] + [InvalidLinq("Expression not supported: a._AppleID because serializer for MongoDB.Analyzer.Tests.Common.DataModel.Apple does not have a member named _AppleID..", DriverVersions.V3_7_OrGreater)] public void Warnings_due_to_bson_ignore() { _ = GetMongoQueryable().Where(f => f.Quantity == 22); diff --git a/tests/MongoDB.Analyzer.Tests.Common/DriverVersions.cs b/tests/MongoDB.Analyzer.Tests.Common/DriverVersions.cs index 2e82992e..3c789185 100644 --- a/tests/MongoDB.Analyzer.Tests.Common/DriverVersions.cs +++ b/tests/MongoDB.Analyzer.Tests.Common/DriverVersions.cs @@ -19,5 +19,8 @@ public static class DriverVersions public const string V3_0_OrGreater = "[3.0.0, )"; public const string V3_1_AndLower = "[3.0.0, 3.2.0)"; public const string V3_2_OrGreater = "[3.2.0, )"; + public const string V3_2_to_3_6_OrGreater = "[3.2.0, 3.6.0]"; + public const string V3_6_AndLower = "[3.0.0, 3.6.0]"; + public const string V3_7_OrGreater = "[3.7.0, )"; } }