Entity Framework Unit Testing with SQLLocalDB

Summary I’ve published a few blog posts on the usage of SQLLocalDB with NHibernate. Now I’m going to demonstrate how easy it is to use with EF. In fact, SQLLocalDB can be used with ADO queries and LINQ-To-SQL. If you’re dealing with legacy code and your methods use a lot of database access operations, it … Read moreEntity Framework Unit Testing with SQLLocalDB

How to detect if your code was called from a unit test

I’ve done a few unit test blog posts, but this time I’m going to demonstrate how to detect if a method is running under a unit test. This flag can be used to break dependencies in an object or run a test database instance instead of the production instance. The first article I stumbled across … Read moreHow to detect if your code was called from a unit test

SQLLocalDB Fast Unit Tests

Summary One of my previous posts described how to setup a MS SQL Lite server called LocalDB. My little demo project worked really good except for one detail. It was slow. The primary problem was that I was starting the instance, creating the database in the unit test initialize (called [TestInitialize]) and then I was … Read moreSQLLocalDB Fast Unit Tests

Unit Testing Fluent NHibernate

Summary I’ve covered a little unit testing of NHibernate in the past. I showed how to use SQLite, which is the most common method of unit testing (technically, integration testing) an NHibernate application. If you’re using MS SQL server for your application, SQLite has some serious limitations that could hinder your unit tests. So I’m … Read moreUnit Testing Fluent NHibernate