[Mono-devel-list] Upgrading of NUnit 1.x tests

Martin Willemoes Hansen mwh at sysrq.dk
Tue Mar 11 03:36:04 EST 2003


On Tue, 2003-03-11 at 03:54, Sebastien Pouliot wrote:
> Hello Martin,
> 
> I've updated the security assemblies to NUnit 2 so I'll share my (limited)
> knowledge.
> 
> > Should I also just remove AllTests.cs?
> 
> Yes (well in most case). Some unit test assemblies may not compile correctly
> if any static methods has been defined (like I did to compare buffers in the
> crypto unit tests). Anyway if it compile without the AllTest.cs then it is
> not required in NUnit2 (and should be removed).

Okidoki.

> > Microsoft.VisualBasic_test.build seems to use the old unit testing
> > framework, should it also be removed?
> 
> NO!!! ;-)
> Please update the .build file so that the unit tests will still works under
> Windows (which use NAnt to build them). You can have a look at
> corlib_test.build (or any other updated test suite).

ahh sure.
Im a little confused about NAnt, will it continue to be used in mono or
will it disapear sometime?

> BTW I had a quick look into the *Test.cs.diff files and they look ok to me
> (as long as the result still works without errors on MS CLR). Maybe Nick can
> give you more comments on them and/or better answers to your questions.

Thanks for your review, ill go on today and fix many more of the Unit
tests.

Yesterday I also converted the tests in the Mono.Directory.LDAP
assembly, unfortunetly I cannot compile that assembly and thus I cannot
test the new unit tests :( I have attached them for review.

I renamed QueryRootDSE.cs to QueryRootDSETest.cs.

> Sebastien Pouliot
> Security Architect, Motus Technologies, http://www.motus.com/
> work: spouliot at motus.com
> home: spouliot at videotron.ca
-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh at sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net	
--------------------------------------------------------               
-------------- next part --------------
A non-text attachment was scrubbed...
Name: makefile.gnu.diff
Type: text/x-makefile
Size: 1143 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030311/582a8407/attachment.bin 
-------------- next part --------------
1,7d0
< --target library
< -o dslib_linux_test.dll
< --noconfig
< -r ../../lib/Mono.Directory.LDAP.dll
< -r ../../lib/corlib.dll
< -r ../../lib/System.dll
< -r ../../../nunit/NUnitCore_mono.dll
9,10c2
< Mono.Directory.LDAP/QueryRootDSE.cs
< Mono.Directory.LDAP/AllTests.cs
---
> Mono.Directory.LDAP/QueryRootDSETest.cs
-------------- next part --------------
0a1
> // BindSimpleTest.cs 
8,10c9,10
< 	public class BindSimpleTest : TestCase {
< 		public BindSimpleTest () :
< 			base ("[MonoTests.Directory.LDAP.BindSimpleTest]'") {}
---
> 	[TestFixture]
> 	public class BindSimpleTest {
12,13c12,13
< 		public BindSimpleTest (string name) :
< 			base (name) {}
---
> 		[SetUp]
> 		public void GetReady () {}
15c15,16
< 		protected override void SetUp () {}
---
> 		[TearDown]
> 		public void Clear () {}
17,19c18,19
< 		protected override void TearDown () {}
< 
< 		public static ITest Suite
---
> 		[Test]
> 		public void Stuff() 
21,27d20
< 			get {
< 				return new TestSuite (typeof (BindSimpleTest));
< 			}
< 		}
< 		
< 
< 		public void TestStuff() {
-------------- next part --------------
// QueryRootDSETest.cs

using NUnit.Framework;
using System;
using Mono.Directory.LDAP;

namespace MonoTests.Directory.LDAP
{
	[TestFixture]
	public class QueryRootDSETest {

		[SetUp]
		public void GetReady () {}

		[TearDown]
		public void Clear () {}

		[Test]
		public void Stuff() 
		{
			string myLDAPPath = "ldap://ldap.toshok.org";
			try {
				LDAP ld = new LDAP (myLDAPPath);
				LDAPMessage res, entry;
				string[] attrs = { "+", null };

				/* don't bind, we do this anonymously */

				ld.Search ("" /* root dse */,
					   SearchScope.Base,
					   "(objectclass=*)",
					   attrs, false,
					   TimeSpan.FromSeconds(10), 0 /* no size limit */,
					   out res);

				if (res == null) {
				  Console.WriteLine ("the search failed");
				}

				Console.WriteLine ("There are {0} entries", res.CountEntries());

				entry = res.FirstEntry();
				if (entry == null)
				  Console.WriteLine ("null returned from res.FirstEntry");

				string[] extensions = entry.GetValues ("supportedExtension");

				if (extensions != null) {
				  foreach( String e in extensions )
				    Console.WriteLine ("Supported Extension: {0}\n", e);
				}
				else {
					Console.WriteLine ("null returned from entry.GetValues\n");
				}
			}
			catch(Exception e) {
				Console.WriteLine("The '" + myLDAPPath + "' path not found.");
				Console.WriteLine("Exception : " + e.Message);
				Console.WriteLine(e.StackTrace);
			}
		}
	}
}


More information about the Mono-devel-list mailing list