Author: gert
Date: 2008-02-09 09:51:03 -0500 (Sat, 09 Feb 2008)
New Revision: 95337

Added:
   trunk/gert/standalone/bug360157/
   trunk/gert/standalone/bug360157/default.build
   trunk/gert/standalone/bug360157/test.cs
Modified:
   trunk/gert/standalone/known-issues
Log:
Added test for bug #360157.


Added: trunk/gert/standalone/bug360157/default.build
===================================================================
--- trunk/gert/standalone/bug360157/default.build       2008-02-09 14:48:18 UTC 
(rev 95336)
+++ trunk/gert/standalone/bug360157/default.build       2008-02-09 14:51:03 UTC 
(rev 95337)
@@ -0,0 +1,31 @@
+<project name="bug360157" default="rebuild">
+       <include buildfile="../../build/common.build" />
+       
+       <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+       <target name="clean">
+               <delete>
+                       <fileset>
+                               <include name="out" />
+                               <include name="test.exe" />
+                       </fileset>
+               </delete>
+       </target>
+
+       <target name="compile" depends="init">
+               <csc target="exe" define="${csc.defines}" output="test.exe" 
warnaserror="true" warninglevel="4">
+                       <sources>
+                               <include name="../../build/common/Assert.cs" />
+                               <include name="test.cs" />
+                       </sources>
+                       <references>
+                               <include name="System.Data.dll" />
+                       </references>
+               </csc>
+       </target>
+
+       <target name="run-test" depends="compile">
+               <exec program="test.exe" managed="true" output="out" />
+               <fail if="${file::exists('out')}" />
+       </target>
+</project>


Property changes on: trunk/gert/standalone/bug360157/default.build
___________________________________________________________________
Name: svn:eol-style
   + native

Added: trunk/gert/standalone/bug360157/test.cs
===================================================================
--- trunk/gert/standalone/bug360157/test.cs     2008-02-09 14:48:18 UTC (rev 
95336)
+++ trunk/gert/standalone/bug360157/test.cs     2008-02-09 14:51:03 UTC (rev 
95337)
@@ -0,0 +1,50 @@
+using System;
+using System.Data.SqlClient;
+
+class Program
+{
+       static int Main ()
+       {
+               if (Environment.GetEnvironmentVariable ("MONO_TESTS_SQL") == 
null)
+                       return 0;
+
+               string connectionString = CreateConnectionString ();
+
+               try {
+                       using (SqlConnection sqlConnection = new SqlConnection 
(connectionString)) {
+                               sqlConnection.Open ();
+                       }
+                       return 1;
+               } catch (SqlException) {
+               }
+
+               try {
+                       using (SqlConnection sqlConnection = new SqlConnection 
(connectionString)) {
+                               sqlConnection.Open ();
+                       }
+                       return 2;
+               } catch (SqlException) {
+               }
+
+               return 0;
+       }
+
+       static string CreateConnectionString ()
+       {
+               string server = Environment.GetEnvironmentVariable 
("MONO_TESTS_SQL_HOST");
+               if (server == null)
+                       throw new ArgumentException ("The MONO_TESTS_SQL_HOST 
environment variable is not set.");
+
+               string user = Environment.GetEnvironmentVariable 
("MONO_TESTS_SQL_USER");
+               if (user == null)
+                       throw new ArgumentException ("The MONO_TESTS_SQL_USER 
environment variable is not set.");
+
+               string pwd = Environment.GetEnvironmentVariable 
("MONO_TESTS_SQL_PWD");
+               if (pwd == null)
+                       throw new ArgumentException ("The MONO_TESTS_SQL_PWD 
environment variable is not set.");
+
+               return string.Format 
("Server={0};Database=DoesNotExist;Pooling=true;" +
+                       "Connection Lifetime=60;Max Pool Size=1;UID={1};" +
+                       "Password={2}", server, user, pwd);
+       }
+}


Property changes on: trunk/gert/standalone/bug360157/test.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues  2008-02-09 14:48:18 UTC (rev 95336)
+++ trunk/gert/standalone/known-issues  2008-02-09 14:51:03 UTC (rev 95337)
@@ -141,3 +141,4 @@
 bug353537/**
 bug358987/**
 bug359783/**
+bug360157/**

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to