Scaffolding properties on object/input
-
29. února 2012 0:26
Is there a way (via Visual Studio add-on or an extension) to automatically expand properties of an complex type that is used to feed input into a method call under test.
[TestMethod] public void TestMethod() { var foo = new Foo { Property1 = 3, Property2 = 1.68m, Property3 = EnumValue.Value1, Property4 = new Bar { PropertyB1 = 1, PropertyB2 = "test", }, Property5 = "Abc" }; var restult = Method(foo); Assert.AreEqual(1, restult); }
Visual Studio Unit Test Wizard does create a TestMethod scaffolding; but leaves complex types will a null assignment. It would be desirable to have all the properties written out; such that only the values then would have to be typed in.
Všechny reakce
-
1. března 2012 3:20Moderátor
Hi Mike,
Thank you for posting in the MSDN forum.
Based on your description, you want to extend the Visual Studio Unit Test, I did some research about this issue, I don’t find a complete solution, but I find a blog about Extending the Visual Studio Unit Test Type, hope it can provide useful information.
If no help, you can send the feature request via: http://visualstudio.uservoice.com/forums/121579-visual-studio Microsoft engineers will evaluate them seriously, thanks for your understanding.
Best Regards,
Jack Zhai [MSFT]
MSDN Community Support | Feedback to us
- Označen jako odpověď Jack Zhai - MSFTMicrosoft Contingent Staff, Moderator 7. března 2012 2:32