-
Notifications
You must be signed in to change notification settings - Fork 10
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
VS-77: Add more enum test cases #35
Conversation
Moved tests for Nullable Enums Added more Enumerator Arithmetic Operation Test Cases Added Test Cases for Unsupported Enum Operations
.Where(u => u.Vehicle.VehicleType.Type == vehicleType) | ||
.Select(u => u.Vehicle.LicenceNumber); | ||
|
||
VehicleTypeEnum? nullibleVehicleType = VehicleTypeEnum.Bus; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nullable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
_ = GetMongoQueryable<Person>() | ||
.Where(u => u.Vehicle.VehicleType.Type == nullibleVehicleType) | ||
.Select(u => u.Vehicle.LicenceNumber); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work in linq. So we need to generate mql.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created another ticket for Nullable support(i.e. VS-93) will implement changes in that ticket
var secondVehicleType = VehicleTypeEnum.Motorcylce; | ||
|
||
_ = GetMongoQueryable<EnumHolder>() | ||
.Where(u => u.EnumUInt64 == firstUnsignedEnum || u.EnumUInt64 == secondUnsignedEnum || u.EnumUInt64 == thirdUnsignedEnum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest modifying the test to test all enum types (byte, short, etc) once in single statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -130,5 +130,15 @@ public void Query_syntax() | |||
where ReturnArgument(ReturnArgument(ReturnArgument(this).ReturnArgument(person.Vehicle.VehicleType))).Type == VehicleTypeEnum.Bus | |||
select person; | |||
} | |||
|
|||
[InvalidLinq("Convert(Convert((Convert({document}{EnumInt16}, Int32) + 10), GenType_Enum_12), Int32) is not supported.")] | |||
[InvalidLinq3("Cannot find serializer for Convert(u.EnumInt16, Int32).", version: "[2.14.0-beta1, 2.18.0)")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's have constants for versions (DriverVersions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
.Where(u => u.EnumInt64 == EnumInt64.Value0 + 35); | ||
|
||
_ = GetMongoQueryable<EnumHolder>() | ||
.Where(u => u.EnumInt64 == EnumInt64.Value0 - 35); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -21,7 +21,13 @@ public static class DriverVersions | |||
public const string Linq3NonDefault = "[2.14.0-beta1, 2.19.0)"; | |||
public const string Linq3DefaultAndHigher = V2_19_AndHigher; | |||
public const string Linq2DefaultAndLower = V2_18_AndLower; | |||
|
|||
public const string V2_14_Beta1_Till_V2_18 = "[2.14.0-beta1, 2.18.0)"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this used?
_ = GetMongoQueryable<EnumHolder>() | ||
.Where(u => u.EnumInt32 == EnumInt32.Value0 - 25); | ||
|
||
_ = GetMongoQueryable<EnumHolder>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about left-hand operations: .Where(u => u.EnumInt32 + 123 == EnumInt32.Value0 - 25)
Added more Enum Test Cases for LINQ covering situations where the Enum is in a variable and that variable is referenced in the query(i.e. either query syntax or the method invocation syntax).