-
Notifications
You must be signed in to change notification settings - Fork 261
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
Support generic test method #4204
Conversation
I admit I did not read the whole PR in detail, but have you checked the impact on test id generation and if all the different ways you can use generic methods will reflect correctly there so we continue working with test explorer? The tests seem to be testing just data driven tests, but generic methods are also used as templates for tests where parent specifies the test, and children specialize the tests. e.g. This 1 set of tests works for all implementations of IRepository. I don't say you should implement all that, but enabling generic methods in one place should probably at look at how much other work it will be to enable this in other places as well. |
I'll do quick testing for TE, then maybe we can sync to make sure everything is fine.
I'm not following. Could you give an example of non-data-driven test that is generic? |
https://learn.microsoft.com/en-us/visualstudio/test/unit-tests-for-generic-methods?view=vs-2022#test-method something like this. Minus the helper method that actually runs the tests. |
maybe something like this: public void BinaryProtocolMessageCanBeSerializedAndDeserialized<TMessage>() { var mess = new T() ... }
[TestMethod]
public void BinaryProtocolMessageCanBeSerializedAndDeserialized<HandshakeMessage>() =>
BinaryProtocolMessageCanBeSerializedAndDeserialized<HandshakeMessage>(); |
disregard my comments, I think my brain does not work today. |
Fixes #2402