Click here to Skip to main content
15,896,207 members
Articles / Database Development / SQL Server

Armadillo: Unit Testing of inline SQL with a little help from Attributes and Reflection

Rate me:
Please Sign up or sign in to vote.
4.65/5 (23 votes)
28 Nov 2005CPOL13 min read 67.4K   930   58  
This article provides a way for automatically testing SQL embedded in your Data Access Layer (DAL) before publishing a new release of your application.
using System;
using OKOKO.Armadillo.Framework;
using OKOKO.MyBiz;
using NUnit.Framework;

namespace OKOKO.MyBiz.Dal.Test
{
	/// <summary>
	/// Launch the tests
	/// </summary>
	[TestFixture()]
	public class DalTest
	{
		[SetUp()]
		public void Init()
		{
			Dal.Cnx.Open();
		}

		[TearDown()]
		public void Down()
		{
			Dal.Cnx.Close();
		}

		[Test()]
		public void TestDB()
		{
			IDbInfo dbInfo = new SqlServerDbInfo(Dal.Cnx);	//Selection of Sql Server as target DB

			TestEngine te = new TestEngine(
				System.Reflection.Assembly.GetAssembly(typeof(Customer)),
				dbInfo);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect Icinetic
Spain Spain
Ph.D in Computer Sciences. My research interest is focus on Conceptual Models, Software Engineering, Code Generation, Model Execution, & UI Patterns.
I work for Icinetic, Seville, Spain building http://Radarc.net and other MDD technologies.

Comments and Discussions