Dynamic data display name#373
Conversation
| } | ||
|
|
||
| [TestMethod] | ||
| public void GetDisplayNameShouldReturnAppropriateNameWithDataRowDisplayName() |
There was a problem hiding this comment.
Please consider changing testmethod name to GetDisplayNameShouldReturnProvidedDisplayName() or GetDisplayNameShouldReturnSpecifiedDisplayName()
| /// <summary> | ||
| /// Gets or sets the name of method used to customize the display name in test results. | ||
| /// </summary> | ||
| public string DynamicDisplayName { get; set; } |
There was a problem hiding this comment.
Consider renaming this to "DynamicDataDisplayName"
| /// <summary> | ||
| /// Gets or sets the declaring type used to customize the display name in test results. | ||
| /// </summary> | ||
| public Type DynamicDisplayNameDeclaringType { get; set; } |
There was a problem hiding this comment.
Same here. "DynamicDataDisplayNameDeclaringType"
| { | ||
| var methodInfo = this.dummyTestClass.GetType().GetTypeInfo().GetDeclaredMethod("TestMethod1"); | ||
| this.dynamicDataAttribute = new DynamicDataAttribute("ReusableTestDataProperty", typeof(DummyTestClass)); | ||
| this.dynamicDataAttribute = new DynamicDataAttribute("ReusableTestDataProperty2", typeof(DummyTestClass2)); |
| } | ||
|
|
||
| [TestFrameworkV1.TestMethod] | ||
| public void GetDisplayNameShouldThrowExceptionIfMethodDoesNotMatchExpectedSignature() |
There was a problem hiding this comment.
Please add Tests for cases like :
- Method not existing i.e InvalidCustomDynamicDataDisplayName is not present in class
- Method has wrong signature i.e. when first parameter doesn't match, second parameter doesn't match, return type doesn't match. Write tests for each of them separately.
There was a problem hiding this comment.
Done. Also picked up a bug where I wasn't checking that the method was static.
| <data name="DynamicDataValueNull" xml:space="preserve"> | ||
| <value>Value returned by property or method {0} shouldn't be null.</value> | ||
| </data> | ||
| <data name="DynamicDataDisplayName" xml:space="preserve"> |
There was a problem hiding this comment.
Also please run "build.cmd -uxlf" so the string addition is localizable. You would have to commit the xlf files changes post running the script.
There was a problem hiding this comment.
I ran this and have committed the xlf files. I'm assuming someone or some magic will do the translation?
There was a problem hiding this comment.
Yes please. We just needed modified xlf files. We will take care of the translation 😄
|
@bstoney : Apologies for the delay. |
|
@bstoney : Can you make the necessary changes here please? |
| throw new ArgumentNullException( | ||
| string.Format( | ||
| FrameworkMessages.DynamicDataDisplayName, | ||
| this.DynamicDataDisplayName, |
There was a problem hiding this comment.
@bstoney : Method signature should also have "public" access modifier specified. Can you please add that as well??
There was a problem hiding this comment.
You will have to update xlf files as well if you modify FrameworkMessages.DynamicDataDisplayName string.
There was a problem hiding this comment.
Done. Interestingly it did work with a private static method even though the documentation for GetDeclaredMethod states that "Returns an object that represents the specified public method declared by the current type." I have updated the exception message and added a test for public accessibility.
Fixes #351
Added dynamic display name to DynamicDataAttribute