Archive for December, 2009

Concatenate nvarchar field and ntext field. Push LINQ to convert ntext to nvarchar.

Let’s assume that we have a table like

This table contains a field name of type nvarchar(50) and a field description of type ntext. Assume we need name and description field values concatenated in one field. Using LINQ we can write a query like that.

1: var result = (from r in [...]

Using TestCase arrtibute of NUnit

Sometimes ago NUnit extend their framework with a possibility to specify parameters via an attribute and then these parameters are reused by NUnit run-time and the test method is executed several times with different parameters. An example: let’s assume that we have a method that concatenates person first name and person last name.

[...]