I am a big fan of StyleCop, it makes my life easier. A bunch of other people have thought of good rules, and I gladly follow them by enabling StyleCop. Recently I have been messing with Coded Ui extensibility, and came across this article:
http://blogs.msdn.com/b/gautamg/archive/2010/01/05/2-hello-world-extension-for-coded-ui-test.aspx
The sample code below makes StyleCop unhappy because the using
statements are outside of the namespace. However, I can move only the two System*
packages in - the third is needed to define an assembly attribute, and I cannot throw assembly:
inside of a namespace.
Is there a clean way to re-organize this code?
using System;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UITest.Common;
using Microsoft.VisualStudio.TestTools.UITest.Extension;
// Attribute to denote that this assembly has UITest extensions.
[assembly: UITestExtensionPackageAttribute("HelloWorldPackage",
typeof(UITestHelloWorldPackage.HelloWorldPackage))]
namespace UITestHelloWorldPackage
{
internal class HelloWorldPackage : UITestExtensionPackage
{
public override object GetService(Type serviceType)
{
Trace.WriteLine("Hello, World");
return null;
}
....