问题
I'm building a Web Test using Microsoft VS2010.
I used the explanation on MSDN: How to: Create a Custom Validation Rule for a Web Performance Test.
In the example there using string
and int
as private members with public "get" and "set" those parameters valid for edit in the UI when I add this validation rule to my test.
I want to have an Enum with 3 option that when I add the validation rule to the UI I can choose from.
Is there a way to add an Enum variable which will also be valid in the UI ?
Are there any other types which can be used which will be valid in the UI ?
回答1:
Unfortunately the UI only shows String and primitive-type properties in user-created rules/plugins. Yet some built-in rules/plugins use enums... how can this be? Thanks to the magic of the disassember and some detective work, we discover that it only accepts enums whose assembly name contains the string "Microsoft.VisualStudio.QualityTools.WebTestFramework".
So if you go to the trouble of compiling your enums (or indeed, your entire project) into an assembly called, for example, "MyEnums.Microsoft.VisualStudio.QualityTools.WebTestFramework", BOOM your enum-typed properties will happily appear in the editor UI.
来源:https://stackoverflow.com/questions/13220677/enum-in-custom-web-test-validation-rule