After reading the following article Create Test Conditions for the Database Unit Test Designer on MSDN i decided to try create a custom test condition for my database unit tests
- Ive met the requirements of either Ultimate or Premium as my environment.
- Created a new class lib project and referenced
Microsoft.Data.Schema.UnitTesting
andMicrosoft.Data.Schema
as well asMicrosoft.Data.Schema.Sql
- I created a class inheriting from TestCondition and called it ExpectedSqlException defined as the following
EDIT:
[DisplayName("Some test condition")]
[DatabaseSchemaProviderCompatibility(null)]
public class SomeTestCondition : TestCondition
{
public override void Assert(System.Data.Common.DbConnection validationConnection, Microsoft.Data.Schema.UnitTesting.ExecutionResult[] results)
{
...
}
}
Following the how to I then created the extentions.xml file that i then placed in
%ProgramFiles%\Microsoft Visual Studio 10.0\VSTSDB\Extensions
and it looks like so (the type key/value is my assembly public info, this should be different for yours)<?xml version="1.0" encoding="utf-8"?> <extensions assembly="" version="1" xmlns="urn:Microsoft.Data.Schema.Extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:Microsoft.Data.Schema.Extensions Microsoft.Data.Schema.Extensions.xsd"> <extension type="SomeTestCondition.SomeTestCondition" assembly="SomeTestCondition, Version=1.0.0.0, Culture=neutral, PublicKeyToken=01a289ad96d7a8a8" enabled="true" /> </extensions>
And registered the assembly into the GAC after signing the assembly
So now with my new TestCondition i should be able to use it within the database unit testing designer to define expectations, BUT ALAS IT DOES NOT WORK :(
Can someone help me with this? what am i missing?