Enterprise Library 5.0 Unit Test Setup Notes

Enterprise Library 5.0 Unit Test SetupUp to this point there has been no compelling need to deal with Enterprise Library Unit Test Setup. Recently fate has shifted my view point, enlightening me to the pleasure of working with Enterprise Library 5.0. Sifting through the mud to get the unit tests setup and passing has been interesting and too much needless effort. In all the documentation for Enterprise Library why has setting up proper test environment gone neglected. At one point document EntLib Test Guide 2005 and EntLib Test Guide Download 2007 provide details and a few blog posts, Enterprise Library Unit Tests in 2005, Don’t Forget to run the Install Services script after installing the Enterprise Library back in 2005 spoke to a few gotchas.



Software Requirements:

  1. Oracle Client ( version )
  2. Oracle ODP.NET ( version )
  3. Install Oracle 11g XE or Oracle 11g Database ( version )
  4. SQLPlus
  5. SQL Developer or TOAD, etc.
  6. SQL Server 2008 Express or Server
  7. SQL Server Management Studio

Enterprise Library Test Solution Configuration:

  1. Run Setup Oracle

    • .\Scripts\Oracle\ReadMe.txt
  2. Eanble SQL Autentication ( Mixed Mode )

    • Use SQL Server Management Studio OR Run EnableSQLAuth.reg
  3. Run SQL Server Setup ( Setups Northwind, Logging and Caching dbs )

    • .\Scripts\InstallDbs.bat
  4. Build Solution withiin IDE

  5. Register the latest version for EL services The Steps below outline how to run \Scripts\InstallServices4.bat

    • Open a cmd prompt as Admin
    • Change directory to Scripts dir
    • cd \EL5.0\Source\Mainline\Scripts
    • Register services for new version targeting 4.0 runtime
    • Run InstallServices4.bat ..\bin\Debug\ OR Run InstallServices4.bat ..\bin\Release\
    • verify output for errors

Oracle Database Setup

Enterprise Library 5.0 leverages the northwind database for Oracle to run unit tests. To support the tests please run the outlined setup below.

Please make updates to gist version for others to benefit. https://gist.github.com/segilbert/5095533

Oracle Setup Northwind:

At this point the creation is not automated, instead for now, please follow the manually steps outlined below. Connect to SQLPLUS, SQL Developer or other tool of choice as SYSTEM.

Run the scripts in order. If the TESTUSER northwind oracle database exist run the 1st line in 1.northwind.oracle.schema.sql file.

1. Connect as SYSTEM then run scripts below
2. 1.northwind.oracle.schema.sql
3. Create a connection to the new Oracle Northwind database.
    USERANME - TESTUSER
    PWD - testuser
4. Connect as TESTUSER to Norhtwind and run scripts below
5. 2.northwind.oracle.tables.views.sql
6. 3.northwind.oracle.packages.sql
7. 4.northwind.oracle.sps.sql
8. 5.northwind.oracle.seed.sql
9. 6.northwind.oracle.constraints.sql

Importing Oracle Northwind Dump file.

  1. Run import.oracle.northwind.cmd file

Exporting Oracle Northwind Dump file.

  1. Run export.oracle.northwind.cmd file

Add the TNS Oracle connection entries outlined below to local tnsnames.ora file. <install>network\admin\tnsnames.ora

Entlib TNS Entry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = MACHINENAME.domain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )
entlib =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = MACHINENAME.domain)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

References

Comments