vendredi 29 juillet 2016

Open Access DB using NAnt build script

I am trying to open an Access DB in a Unit Test.

The following code works fine while running the test in Visual Studio Test Explorer, but fails while using NAnt build script.

    public static void CreateAccessDBConnection()
    {
        string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data"
                    + @" Source=~\..\..\..\..\MeisTestingData.accdb";

        conn = new System.Data.OleDb.OleDbConnection(connectionString);

        conn.Open(); //This call is failing --> System.Runtime.InteropServices.SEHException : External component has thrown an exception
    }

<copy file="${build.dir}/${app.name}.MVC.QA.dll-results.xml" tofile="${build.dir}/MEIS-Unit-Tests-Result.xml" overwrite="true" />

Aucun commentaire:

Enregistrer un commentaire