سؤال

Simple console application open connection without any problems:

    static void Main(string[] args)
    {
        string connectionString = String.Format(
           @"Provider=OraOLEDB.Oracle;PLSQLRSet=1;Password={0};Persist Security Info=True;User ID={1};Data Source={2};OLEDB.NET=true;FetchSize=5000",
            "pwd", "schema", "server");

        using (IDbConnection con = new OleDbConnection(connectionString))
        {
            con.Open();
            Console.WriteLine("Opened");
        }
        Console.ReadKey();
    }

but if try do same in the nunit test method:

public class UnitTest1
{
    [Test]
    public void TestMethod1()
    {
        string connectionString = String.Format(
           @"Provider=OraOLEDB.Oracle;PLSQLRSet=1;Password={0};Persist Security Info=True;User ID={1};Data Source={2};OLEDB.NET=true;FetchSize=5000",
            "pwd", "schema", "server");

        using (IDbConnection con = new OleDbConnection(connectionString))
        {
            con.Open();
        }
    }
}

I have got exception: ORA-12154: TNS:could not resolve the connect identifier specified

Obviously problem that is in environment.

How to 'configure' nunit for using 'same' settings as console application

some details:

target framework: 4.0 target platform: x86 nunit 2.5.9 OS: Windows 7 x64

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top