c# - piece of code works in console application, but does not works inside nunit test -


simple console application open connection without 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 same in 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 connect identifier specified

obviously problem in environment.

how 'configure' nunit using 'same' settings console application

some details:

target framework: 4.0 target platform: x86 nunit 2.5.9 os: windows 7 x64

problem cause parenthesis in folder name. (c:\program files (x86))

if run nunit folder c:\something(nunit)\ got same error.

replacing vs path short 8.3 names not me. had install oracle client 11 , problem gone.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -