-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Labels
area-System.SecurityuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Description
The RSA tests should be restructured to facilitate test sharing across the multiple implementations but also to allow the tests to move into one test assembly (in a followup change).
Directives:
- Keep the number of file additions and removals low, and avoid unnecessary edits to existing files (clean diff, purposeful changes only)
- No test coverage loss.
- Only test code may change.
Approach:
- Any RSA test that is using RSAFactory should change from calling RSAFactory as a static to invoking a new static field, s_provider.
- Any methods on RSAFactory that are not on IRSAProvider should be moved to the new RSAProvider class, implemented appropriately.
- For any class that has a test method that needs to change away from using RSAFactory:
- Make the class generic, for example,
ImportExportshould becomeImportExport<TProvider> : where TProvider : IRSAProvider, new() - Introduce a new field,
private static readonly TProvider s_provider = new TProvider(); - ConditionalFact or ConditionalMethod targets that defer to RSAFactory will require a new static property in the current class, and that static property should be initialized by invoking the correct member off of s_provider.
- In the file that defines implementing types of RSAProvider, declare a class directly in the main file namespace named appropriately for the provider being tested, for example, in
RSACryptoServiceProviderProvider.cs, addpublic class RSACryptoServiceProviderImportExport : ImportExport<RSACryptoServiceProviderProvider>;. These new classes don't need a body, as the whole purpose is to use methods from the inherited class.
- Make the class generic, for example,
- The RSAFactory static class will be unused at the end of this process, delete it. If the file is empty, delete the file. If the file it is in still has useful content but is simply misnamed, leave the file name as-is.
- If you need inspiration, look at HmacTests.cs, IRSAProvider will function similar to IHmacTrait, though we can use the static s_provider field in lieu of statics in interfaces.
Reactions are currently unavailable
Metadata
Metadata
Labels
area-System.SecurityuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner