2003-12-17 Sebastien Pouliot <spouliot@videotron.ca>
authorSebastien Pouliot <sebastien@ximian.com>
Thu, 18 Dec 2003 01:41:52 +0000 (01:41 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Thu, 18 Dec 2003 01:41:52 +0000 (01:41 -0000)
* X509SpcTest.cs: Now use Path.GetFullPath for all filenames as
X509Certificate.CreateFromSignedFile sometimes (like on Nick's
computer) didn't "see" the file and returned an empty certificate.

svn path=/trunk/mcs/; revision=21295

mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/ChangeLog
mcs/class/corlib/Test/System.Security.Cryptography.X509Certificates/X509SpcTest.cs

index 9b285056cd0deb6bb58c213045a7ceb7aaf48d70..000df361e7c4e26dc8fd65575615b85b9fc4ecb3 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-17  Sebastien Pouliot  <spouliot@videotron.ca>
+
+       * X509SpcTest.cs: Now use Path.GetFullPath for all filenames as 
+       X509Certificate.CreateFromSignedFile sometimes (like on Nick's
+       computer) didn't "see" the file and returned an empty certificate.
+
 2003-12-15  Sebastien Pouliot  <spouliot@videotron.ca>
 
        * X509CapiTest.cs: New. Unit test for loading a certificate using a
index 10c13bddb669a7e4a57bf5b8b631e5b436084dbf..d56b4a2ea532a8c83b366663b47b4407c2e1ef32 100755 (executable)
@@ -1,5 +1,5 @@
 //
-// X509SPCTest.cs - NUnit Test Cases for X509 Software Publisher Certificate
+// X509SpcTest.cs - NUnit Test Cases for X509 Software Publisher Certificate
 //
 // Author:
 //     Sebastien Pouliot (spouliot@motus.com)
@@ -17,18 +17,17 @@ using System.Text;
 namespace MonoTests.System.Security.Cryptography.X509Certificates {
 
        [TestFixture]
-       public class X509SPCTest : Assertion {
+       public class SoftwarePublisherCertificateTest : Assertion {
 
                [TearDown]
                void TearDown () 
                {
                        try {
-                               File.Delete ("smallspc.exe");
-                               File.Delete ("smallspc-invalid.exe");
-                               File.Delete ("small.exe");
-                       }
-                       catch {
+                               File.Delete (Path.GetFullPath ("smallspc.exe"));
+                               File.Delete (Path.GetFullPath ("smallspc-invalid.exe"));
+                               File.Delete (Path.GetFullPath ("small.exe"));
                        }
+                       catch {}
                }
 
                static private byte[] smallexe = { 
@@ -1003,35 +1002,35 @@ namespace MonoTests.System.Security.Cryptography.X509Certificates {
                [Test]
                public void ValidSignature () 
                {
-                       string filename = "smallspc.exe";
+                       string filename = Path.GetFullPath ("smallspc.exe");
                        WriteFile (filename, smallspcexe);
 
                        X509Certificate spc = X509Certificate.CreateFromSignedFile (filename);
                        X509Certificate cert = new X509Certificate (motus);
-                       AssertEquals ("CreateFromSignedFile", spc.GetRawCertDataString(), cert.GetRawCertDataString());
+                       AssertEquals ("CreateFromSignedFile", cert.GetRawCertDataString (), spc.GetRawCertDataString ());
                }
 
                [Test]
                [ExpectedException (typeof (COMException))]
                public void InvalidSignature () 
                {
-                       string filename = "smallspc-invalid.exe";
+                       string filename = Path.GetFullPath ("smallspc-invalid.exe");
                        byte[] content = (byte[]) smallspcexe.Clone ();
                        // make sure it's invalid
                        byte[] mark = Encoding.ASCII.GetBytes ("bad signature");
                        Buffer.BlockCopy (mark, 0, content, 1024, mark.Length);
                        WriteFile (filename, content);
 
-                       X509Certificate spc = X509Certificate.CreateFromSignedFile ("smallspc-invalid.exe");
+                       X509Certificate spc = X509Certificate.CreateFromSignedFile (filename);
                }
 
                [Test]
                public void NonSignedAssembly () 
                {
-                       string filename = "small.exe";
+                       string filename = Path.GetFullPath ("small.exe");
                        WriteFile (filename, smallexe);
 
-                       X509Certificate spc = X509Certificate.CreateFromSignedFile ("small.exe");
+                       X509Certificate spc = X509Certificate.CreateFromSignedFile (filename);
                        AssertEquals ("NonSignedAssembly", 0, spc.GetHashCode ());
                }
        }