Suppress FxCop CA1822 warning for whole project - warnings

we use FxCop in current project. Warning CA1822 appears for every unit test method in test projects. So I would like to disable it for test projects.
Is it possible to suppress it for whole assembly?

In VS2005 & 2008, go to the Code Analysis tab in Project Properties and uncheck that rule.
In VS2010, create a custom ruleset with that rule disabled, then select it in the Code Analysis tab in Project Properties.

If you're using stand-alone FxCop with multiple assemblies in a .fxcop project then, no, there's no way to disable specific rules for only a subset of the analysis properties. Because of CA1822, I usually create two separte .fxcop projects: one to contain all the "real" code assemblies, and a separate one for the test assemblies in which CA1822 is disabled entirely.

Related

How to configure MonoDevelop for Design-by-Contract (ccrewrite)

C#/Mono enables programming/design-by-contract: one can specify "require" and "ensure" statements. This is done with the System.Diagnostics.Contracts library.
If one reads the specifications, it is required to "rewrite" the program before executing it with ccrewrite. This page http://social.msdn.microsoft.com/Forums/en-US/1d0bc7e9-a1bc-469c-982a-47232308f131/ccrewrite seems to suggest that the action must be executed before building the assembly which is strange because the program will be overwritten after building.
What should one do to enable design-by-contract in MonoDevelop?

How to avoid concordion tests to be executed multiple times when using concordion:run in html

As the title states: How to avoid concordion tests to be executed multiple times when using concordion:run in html.
When you use concordion:run in your links, nice markups appear in the report.
However, adding the concordion:run attribute to your html page also triggers another test execution next to the test execution triggered from the fixture.
The latter is ofcourse very undesirable.
How can I fix this.
Env:
junit 4.8.1
concordion 1.4.4
concordion extensions 1.1.1 (not in use yet)
Create a Concordion specification (html page) that contains links (with concordion:run) to all of the Concordion specifications that you wish to be executed. Then execute only the single fixture class related to this specification.
We tend to structure our Concordion specifications hierarchically, with a top level index page that links to a page for each theme. Each theme page then links to a page for each feature etc. We can then choose to run all of the tests by executing the top level fixture, or just the tests for a theme/feature etc, by running the corresponding fixture class.
It gets slightly more tricky if you want to have the same specification linked to from multiple specifications. Let me know if you're trying to do this - I do have some code to handle this.

Is there a better expression editor available for BIDS SSIS 2008R2?

I've found that editing expressions within a grid column in the BIDS tool (for SSIS 2008R2) is highly impractical for anything but the simplest expressions.
Eg refer the "Expression" column in the "Derived Column Transformation Editor".
Is there an "advanced" editor available within BIDS, or a 3rd party tool, that provides the same drag/drop functionality for available columns/variables/functions, but has enough screen real-estate in the text-editor component such that I can actually see the expression I'm building?
I've come across this: http://expressioneditor.codeplex.com/ . While this looks excellent, from what I can tell it's not actually integrated into BIDS.
This http://bidshelper.codeplex.com/ includes the above editor, but only seems to make it available for expressions found within the Control Flow level (not within Data Flows where I most need it).
There's also a teasing "Open IME" option available in the right-click context menu when editing an expression - but I can't find an Input Method Editor suitable.
Any help appreciated!
Nothing prevents you from creating Variables and using the rich expression editor (control flow one) to build your expressions and then paste them into the needed locations of a data flow. You'll need to update variable references to column references but that's a simple switch.
Perhaps an example will explain (comments suck). RIGHT(#[User::MyVariable], 4) vs RIGHT([MyColumn], 4) I'd use the control flow expression editor to make my expression work right for static data and then fix to work with columns when I was satisfied with the logic.
The rule of thumb I go by is if an Expression takes more room that the window can show, then I should probably look at either using a Script Component to perform the logic or add multiple Derived Column Components in series and build my Expressions piecemeal.

MonoDevelop: Resetting the C# code formatting

Some how my projects (many) are formatting strangely when I ask for a code cleanup (CTRL+SHIFT+F)
Is there a way to clear all the project prefs, establish a global one, and that apply everywhere?
Formatting policies are not global, they are per solution. The global preferences are only used for new solutions or solutions that somehow do not have a formatting policy (e.g. created by Visual Studio).
If you want, you can use the "Custom Policies" dialog to create a new named policy set, and apply that to existing solutions.

Generation custom files from dbml file?

I've been having a look at making changes to the partial classes generated from a DBML file. I was reading into using the sqlmetal.exe tool but it appears that you can't do much customisation of what it actually spits out.
I'm wanting to make changes to the file for serialization purposes, I'd like to add the Data Member Attribute to specified properties in the generated partial classes.
Is this possible to do using the sqlmetal.exe tool or would I need to write my own tool for the file generation?
You could check out T4 templates or CodeSmith for file generation.
No it is not. You can accomplish this with Entity Framework.
http://blogs.msdn.com/jkowalski/archive/2008/05/12/transparent-lazy-loading-for-entity-framework-part-1.aspx
Code written by Jaroslaw Kowalski works much the same way that Linq to SQL does.
It has some issues, but you can do everything with it, because you have the source. I'm going to publish my version soon(support for stored procedures, improved databinding experience and many other useful features)
If you want the datacontract and datamember attributes to be added, simply change the "Serialization Mode" property in the L2S designer's datacontext properties from "None" to "Unidirectional". All entity classes will then be datacontracts, and their members will be datamembers...
The upcoming Beta version of Entity Developer will contain highly customizable T4-like templates for code generation.
Also we have added functionality to divide the generated code into separate files.