开发者

ASP.NET unit testing -- is there a shorthand way of specifying the needed attributes?

开发者 https://www.devze.com 2023-01-31 07:09 出处:网络
My unit tests need the following attributes: [TestMethod()] [HostType(\"ASP.NET\")] [AspNetDevelopmentServerHost(\"C:\\\\projects\\\\dogs\", \"/dogs\")]

My unit tests need the following attributes:

    [TestMethod()]
    [HostType("ASP.NET")]
    [AspNetDevelopmentServerHost("C:\\projects\\dogs", "/dogs")]
    [UrlToTest("http://localhost/dogs")]开发者_如何学Python

I'd hate to have to repeat these attributes for every test. Is there a better way of doing that?


The simplest is to create a code snippet.

http://127.0.0.1:47873/help/1-3572/ms.help?method=page&id=85976AD9-4C9A-4E7B-896E-66EC6F955199&product=VS&productVersion=100&topicVersion=100&locale=EN-US&topicLocale=EN-US

If you use ReSharper it is really easy to add a "Live Template" that allows you to make the snippet more dynamic. I just created a video demo with your snippet for you here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号