Author: spouliot
Date: 2005-04-27 10:15:06 -0400 (Wed, 27 Apr 2005)
New Revision: 43653
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedMemoryTest.cs
Log:
2005-04-27 Sebastien Pouliot <[EMAIL PROTECTED]>
* ProtectedDataTest.cs: Updated to NUnit 2.2 API to use Ignore it the
platform doesn't support ProtectedData.
* ProtectedMemoryTest.cs: Updated to NUnit 2.2 API to use Ignore it
the platform doesn't support ProtectedData.
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog
2005-04-27 12:49:35 UTC (rev 43652)
+++ trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog
2005-04-27 14:15:06 UTC (rev 43653)
@@ -1,3 +1,10 @@
+2005-04-27 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * ProtectedDataTest.cs: Updated to NUnit 2.2 API to use Ignore it the
+ platform doesn't support ProtectedData.
+ * ProtectedMemoryTest.cs: Updated to NUnit 2.2 API to use Ignore it
+ the platform doesn't support ProtectedData.
+
2005-04-23 Sebastien Pouliot <[EMAIL PROTECTED]>
* CryptographicAttributeTest.cs: Changed class names to match beta2.
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs
2005-04-27 12:49:35 UTC (rev 43652)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedDataTest.cs
2005-04-27 14:15:06 UTC (rev 43653)
@@ -1,11 +1,12 @@
//
// ProtectedDataTest.cs - NUnit Test Cases for ProtectedData
//
-// Author:
-// Sebastien Pouliot ([EMAIL PROTECTED])
+// Author:
+// Sebastien Pouliot <[EMAIL PROTECTED]>
//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
#if NET_2_0
@@ -16,11 +17,8 @@
namespace MonoTests.System.Security.Cryptography {
- // References:
- // a.
-
[TestFixture]
- public class ProtectedDataTest : Assertion {
+ public class ProtectedDataTest {
private void ProtectUnprotect (byte[] entropy,
DataProtectionScope scope)
{
@@ -29,13 +27,13 @@
int total = 0;
for (int i=0; i < 16; i++)
total += encdata [i];
- Assert ("Protect", (total != 0));
+ Assert.IsFalse ((total == 0), "Protect");
byte[] decdata = ProtectedData.Unprotect (encdata,
entropy, scope);
total = 0;
for (int i=0; i < 16; i++)
total += decdata [i];
- Assert ("Unprotect", (total == 0));
+ Assert.IsTrue ((total == 0), "Unprotect");
}
[Test]
@@ -48,7 +46,7 @@
ProtectUnprotect (notMuchEntropy,
DataProtectionScope.CurrentUser);
}
catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows 2000 and later");
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
@@ -62,7 +60,7 @@
ProtectUnprotect (notMuchEntropy,
DataProtectionScope.LocalMachine);
}
catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows 2000 and later");
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
@@ -83,7 +81,7 @@
ProtectUnprotect (null,
DataProtectionScope.LocalMachine);
}
catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows 2000 and later");
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
@@ -91,9 +89,14 @@
[ExpectedException (typeof (CryptographicException))]
public void UnprotectNotProtectedData ()
{
- byte[] baddata = new byte [16];
- byte[] notMuchEntropy = new byte [16];
- ProtectedData.Unprotect (baddata, notMuchEntropy,
DataProtectionScope.CurrentUser);
+ try {
+ byte[] baddata = new byte [16];
+ byte[] notMuchEntropy = new byte [16];
+ ProtectedData.Unprotect (baddata,
notMuchEntropy, DataProtectionScope.CurrentUser);
+ }
+ catch (PlatformNotSupportedException) {
+ Assert.Ignore ("Only supported under Windows
2000 and later");
+ }
}
[Test]
Modified:
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedMemoryTest.cs
===================================================================
---
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedMemoryTest.cs
2005-04-27 12:49:35 UTC (rev 43652)
+++
trunk/mcs/class/System.Security/Test/System.Security.Cryptography/ProtectedMemoryTest.cs
2005-04-27 14:15:06 UTC (rev 43653)
@@ -1,11 +1,12 @@
//
// ProtectedMemoryTest.cs - NUnit Test Cases for ProtectedMemory
//
-// Author:
-// Sebastien Pouliot ([EMAIL PROTECTED])
+// Author:
+// Sebastien Pouliot <[EMAIL PROTECTED]>
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
#if NET_2_0
@@ -16,11 +17,8 @@
namespace MonoTests.System.Security.Cryptography {
- // References:
- // a.
-
[TestFixture]
- public class ProtectedMemoryTest : Assertion {
+ public class ProtectedMemoryTest {
private void ProtectUnprotect (MemoryProtectionScope scope)
{
@@ -28,14 +26,14 @@
ProtectedMemory.Protect (data, scope);
int total = 0;
for (int i=0; i < 16; i++)
- total += data [i];
- Assert ("Protect", (total != 0));
+ total += data [i];
+ Assert.IsFalse ((total == 0), "Protect");
ProtectedMemory.Unprotect (data, scope);
total = 0;
for (int i=0; i < 16; i++)
- total += data [i];
- Assert ("Unprotect", (total == 0));
+ total += data [i];
+ Assert.IsTrue ((total == 0), "Unprotect");
}
[Test]
@@ -46,8 +44,8 @@
// not if it's really limited to the scope
specified
ProtectUnprotect
(MemoryProtectionScope.SameProcess);
}
- catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows XP and later");
+ catch (PlatformNotSupportedException) {
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
@@ -59,8 +57,8 @@
// not if it's really limited to the scope
specified
ProtectUnprotect
(MemoryProtectionScope.SameLogon);
}
- catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows XP and later");
+ catch (PlatformNotSupportedException) {
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
@@ -72,8 +70,8 @@
// not if it's really limited to the scope
specified
ProtectUnprotect
(MemoryProtectionScope.CrossProcess);
}
- catch (PlatformNotSupportedException) {
- Console.WriteLine ("Only supported under
Windows XP and later");
+ catch (PlatformNotSupportedException) {
+ Assert.Ignore ("Only supported under Windows
2000 and later");
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches