summary refs log tree commit diff
path: root/crypto/test/src/openpgp
diff options
context:
space:
mode:
authorOren Novotny <oren@novotny.org>2016-12-04 19:25:04 -0500
committerOren Novotny <oren@novotny.org>2016-12-04 19:25:04 -0500
commitdd1b0b2f53c3d83c4be768997943a19f57cc5ece (patch)
tree9770618344d23fab1d3591cea0dacb065f660fda /crypto/test/src/openpgp
parentConvert projects over to cross-compiled net4, netstandard 1.0, netstandard 1.... (diff)
downloadBouncyCastle.NET-ed25519-dd1b0b2f53c3d83c4be768997943a19f57cc5ece.tar.xz
Fix issues compiling tests for .NET Core App (rename Main methods to MainOld) pcl-v1.8.1.2
Diffstat (limited to 'crypto/test/src/openpgp')
-rw-r--r--crypto/test/src/openpgp/test/PGPArmoredTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPClearSignedSignatureTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPCompressionTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPDSAElGamalTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPDSATest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPPBETest.cs46
-rw-r--r--crypto/test/src/openpgp/test/PGPPacketTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPRSATest.cs58
-rw-r--r--crypto/test/src/openpgp/test/PGPSignatureTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpECDHTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpECDsaTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpECMessageTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpKeyRingTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpMarkerTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpParsingTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PgpUnicodeTest.cs5
-rw-r--r--crypto/test/src/openpgp/test/RegressionTest.cs2
18 files changed, 105 insertions, 34 deletions
diff --git a/crypto/test/src/openpgp/test/PGPArmoredTest.cs b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
index aa13477ed..b06275840 100644
--- a/crypto/test/src/openpgp/test/PGPArmoredTest.cs
+++ b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
@@ -248,7 +248,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PGPArmoredTest"; }
 		}
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
 		{
 			RunTest(new PgpArmoredTest());
diff --git a/crypto/test/src/openpgp/test/PGPClearSignedSignatureTest.cs b/crypto/test/src/openpgp/test/PGPClearSignedSignatureTest.cs
index 668f8cce2..fe161e8f1 100644
--- a/crypto/test/src/openpgp/test/PGPClearSignedSignatureTest.cs
+++ b/crypto/test/src/openpgp/test/PGPClearSignedSignatureTest.cs
@@ -428,7 +428,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			generateTest(crNlMessage, "\\r\\n");
 		}
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
 		{
 			RunTest(new PgpClearSignedSignatureTest());
diff --git a/crypto/test/src/openpgp/test/PGPCompressionTest.cs b/crypto/test/src/openpgp/test/PGPCompressionTest.cs
index fdcf7222c..eddfa1e7c 100644
--- a/crypto/test/src/openpgp/test/PGPCompressionTest.cs
+++ b/crypto/test/src/openpgp/test/PGPCompressionTest.cs
@@ -108,7 +108,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PGPCompressionTest"; }
 		}
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
 		{
 			RunTest(new PgpCompressionTest());
diff --git a/crypto/test/src/openpgp/test/PGPDSAElGamalTest.cs b/crypto/test/src/openpgp/test/PGPDSAElGamalTest.cs
index b86324954..e200cec21 100644
--- a/crypto/test/src/openpgp/test/PGPDSAElGamalTest.cs
+++ b/crypto/test/src/openpgp/test/PGPDSAElGamalTest.cs
@@ -475,7 +475,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PGPDSAElGamalTest"; }
 		}
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
 		{
 			RunTest(new PgpDsaElGamalTest());
diff --git a/crypto/test/src/openpgp/test/PGPDSATest.cs b/crypto/test/src/openpgp/test/PGPDSATest.cs
index 7808ed6cd..55e346a6a 100644
--- a/crypto/test/src/openpgp/test/PGPDSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPDSATest.cs
@@ -580,7 +580,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PGPDSATest"; }
         }
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
         {
 			RunTest(new PgpDsaTest());
diff --git a/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs b/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
index 8f702b67b..35e85a2c8 100644
--- a/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
+++ b/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
@@ -152,7 +152,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PGPNoPrivateKeyTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpNoPrivateKeyTest());
diff --git a/crypto/test/src/openpgp/test/PGPPBETest.cs b/crypto/test/src/openpgp/test/PGPPBETest.cs
index 29b786a83..b14506438 100644
--- a/crypto/test/src/openpgp/test/PGPPBETest.cs
+++ b/crypto/test/src/openpgp/test/PGPPBETest.cs
@@ -157,11 +157,16 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
                 TestDateTime);
 
 			ldOut.Write(text, 0, text.Length);
-			ldOut.Close();
+#if PORTABLE
+            ldOut.Dispose();
 
-			comOut.Close();
+            comOut.Dispose();
+#else
+            ldOut.Close();
 
-			//
+			comOut.Close();
+#endif
+            //
             // encrypt - with stream close
             //
             MemoryStream cbOut = new UncloseableMemoryStream();
@@ -173,7 +178,11 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			byte[] bOutData = bOut.ToArray();
 			Stream cOut = cPk.Open(new UncloseableStream(cbOut), bOutData.Length);
             cOut.Write(bOutData, 0, bOutData.Length);
+#if PORTABLE
+            cOut.Dispose();
+#else
             cOut.Close();
+#endif
 
 			data = DecryptMessage(cbOut.ToArray());
             if (!Arrays.AreEqual(data, text))
@@ -321,11 +330,17 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
 			ldOut.Write(msg, 0, msg.Length);
 
-			ldOut.Close();
+#if PORTABLE
+            ldOut.Dispose();
+
+            comOut.Dispose();
+#else
+            ldOut.Close();
 
 			comOut.Close();
-        
-			cbOut = new MemoryStream();
+#endif
+
+            cbOut = new MemoryStream();
 			cPk = new PgpEncryptedDataGenerator(SymmetricKeyAlgorithmTag.Cast5, true, rand);
 
             cPk.AddMethod(pass, HashAlgorithmTag.Sha1);
@@ -335,7 +350,11 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			data = bOut.ToArray();
 			cOut.Write(data, 0, data.Length);
 
-			cOut.Close();
+#if PORTABLE
+            cOut.Dispose();
+#else
+            cOut.Close();
+#endif
 
 			data = DecryptMessage(cbOut.ToArray());
 			if (!AreEqual(data, msg))
@@ -356,18 +375,25 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 		private class UncloseableMemoryStream
 			: MemoryStream
 		{
-			public override void Close()
+#if PORTABLE
+            protected override void Dispose(bool disposing)
+            {
+                throw new Exception("Dispose() called on underlying stream");
+            }
+#else
+            public override void Close()
 			{
 				throw new Exception("Close() called on underlying stream");
 			}
-		}
+#endif
+        }
 
 		public override string Name
         {
 			get { return "PGPPBETest"; }
         }
 
-		public static void Main(
+		public static void MainOld(
 			string[] args)
         {
 			RunTest(new PgpPbeTest());
diff --git a/crypto/test/src/openpgp/test/PGPPacketTest.cs b/crypto/test/src/openpgp/test/PGPPacketTest.cs
index b82f8526f..f8a13eeeb 100644
--- a/crypto/test/src/openpgp/test/PGPPacketTest.cs
+++ b/crypto/test/src/openpgp/test/PGPPacketTest.cs
@@ -63,7 +63,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PGPPacketTest"; }
         }
 
-		public static void Main(
+		public static void MainOld(
             string[] args)
         {
 			RunTest(new PgpPacketTest());
diff --git a/crypto/test/src/openpgp/test/PGPRSATest.cs b/crypto/test/src/openpgp/test/PGPRSATest.cs
index 82b569bbb..8944546fc 100644
--- a/crypto/test/src/openpgp/test/PGPRSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPRSATest.cs
@@ -387,7 +387,11 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
             cOut.Write(bytes, 0, bytes.Length);
 
+#if PORTABLE
+            cOut.Dispose();
+#else
             cOut.Close();
+#endif
 
             byte[] encData = bcOut.ToArray();
 
@@ -735,8 +739,12 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             Stream cOut = cPk.Open(new UncloseableStream(cbOut), shortText.Length);
 
             cOut.Write(shortText, 0, shortText.Length);
-
+            
+#if PORTABLE
+            cOut.Dispose();
+#else
             cOut.Close();
+#endif
 
             pgpF = new PgpObjectFactory(cbOut.ToArray());
 
@@ -772,7 +780,11 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
             cOut.Write(text, 0, text.Length);
 
+#if PORTABLE
+            cOut.Dispose();
+#else
             cOut.Close();
+#endif
 
             pgpF = new PgpObjectFactory(cbOut.ToArray());
 
@@ -981,11 +993,19 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
                 sGen.Update((byte)ch);
             }
 
+#if PORTABLE
+            lOut.Dispose();
+#else
             lOut.Close();
+#endif
 
             sGen.Generate().Encode(bcOut);
-
+            
+#if PORTABLE
+            bcOut.Dispose();
+#else
             bcOut.Close();
+#endif
 
             //
             // verify generated signature
@@ -1056,12 +1076,20 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
                 lOut.WriteByte((byte) ch);
                 sGen.Update((byte)ch);
             }
-
+            
+#if PORTABLE
+            lOut.Dispose();
+#else
             lOut.Close();
+#endif
 
             sGen.Generate().Encode(bcOut);
 
+#if PORTABLE
+            bcOut.Dispose();
+#else
             bcOut.Close();
+#endif
 
             //
             // verify generated signature
@@ -1157,12 +1185,21 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
                 lOut.WriteByte((byte)ch);
                 sGen.Update((byte)ch);
             }
-
+            
+#if PORTABLE
+            lOut.Dispose();
+#else
             lOut.Close();
+#endif
 
             sGen.Generate().Encode(bcOut);
 
+#if PORTABLE
+            bcOut.Dispose();
+#else
             bcOut.Close();
+#endif
+
 
             //
             // verify generated signature
@@ -1205,10 +1242,17 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
         private class UncloseableMemoryStream
             : MemoryStream
         {
-            public override void Close()
+#if PORTABLE
+            protected override void Dispose(bool disposing)
             {
-                throw new Exception("Close() called on underlying stream");
+                throw new Exception("Dispose() called on underlying stream");
             }
+#else
+            public override void Close()
+			{
+				throw new Exception("Close() called on underlying stream");
+			}
+#endif
         }
 
         public override string Name
@@ -1216,7 +1260,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PGPRSATest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpRsaTest());
diff --git a/crypto/test/src/openpgp/test/PGPSignatureTest.cs b/crypto/test/src/openpgp/test/PGPSignatureTest.cs
index 40fee7a5f..6aca68134 100644
--- a/crypto/test/src/openpgp/test/PGPSignatureTest.cs
+++ b/crypto/test/src/openpgp/test/PGPSignatureTest.cs
@@ -1028,7 +1028,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PGPSignatureTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpSignatureTest());
diff --git a/crypto/test/src/openpgp/test/PgpECDHTest.cs b/crypto/test/src/openpgp/test/PgpECDHTest.cs
index b7c500bd0..fb65d1de6 100644
--- a/crypto/test/src/openpgp/test/PgpECDHTest.cs
+++ b/crypto/test/src/openpgp/test/PgpECDHTest.cs
@@ -263,7 +263,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PgpECDHTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpECDHTest());
diff --git a/crypto/test/src/openpgp/test/PgpECDsaTest.cs b/crypto/test/src/openpgp/test/PgpECDsaTest.cs
index 6259ef627..5bcc3ba68 100644
--- a/crypto/test/src/openpgp/test/PgpECDsaTest.cs
+++ b/crypto/test/src/openpgp/test/PgpECDsaTest.cs
@@ -188,7 +188,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PgpECDsaTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpECDsaTest());
diff --git a/crypto/test/src/openpgp/test/PgpECMessageTest.cs b/crypto/test/src/openpgp/test/PgpECMessageTest.cs
index ac8283721..4a11dbdcc 100644
--- a/crypto/test/src/openpgp/test/PgpECMessageTest.cs
+++ b/crypto/test/src/openpgp/test/PgpECMessageTest.cs
@@ -179,7 +179,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PgpECMessageTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpECMessageTest());
diff --git a/crypto/test/src/openpgp/test/PgpKeyRingTest.cs b/crypto/test/src/openpgp/test/PgpKeyRingTest.cs
index 5f38609cf..c65b5ee3d 100644
--- a/crypto/test/src/openpgp/test/PgpKeyRingTest.cs
+++ b/crypto/test/src/openpgp/test/PgpKeyRingTest.cs
@@ -2374,7 +2374,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             get { return "PgpKeyRingTest"; }
         }
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             RunTest(new PgpKeyRingTest());
diff --git a/crypto/test/src/openpgp/test/PgpMarkerTest.cs b/crypto/test/src/openpgp/test/PgpMarkerTest.cs
index 89be7cd52..a4f95dfc1 100644
--- a/crypto/test/src/openpgp/test/PgpMarkerTest.cs
+++ b/crypto/test/src/openpgp/test/PgpMarkerTest.cs
@@ -85,7 +85,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PgpMarkerTest"; }
         }
 
-		public static void Main(
+		public static void MainOld(
             string[] args)
         {
             RunTest(new PgpMarkerTest());
diff --git a/crypto/test/src/openpgp/test/PgpParsingTest.cs b/crypto/test/src/openpgp/test/PgpParsingTest.cs
index 78fca7570..34fc0af5f 100644
--- a/crypto/test/src/openpgp/test/PgpParsingTest.cs
+++ b/crypto/test/src/openpgp/test/PgpParsingTest.cs
@@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			get { return "PgpParsingTest"; }
 		}
 
-        public static void Main(
+        public static void MainOld(
 			string[] args)
 		{
 			RunTest(new PgpParsingTest());
diff --git a/crypto/test/src/openpgp/test/PgpUnicodeTest.cs b/crypto/test/src/openpgp/test/PgpUnicodeTest.cs
index 534e8a471..7f1bc62d1 100644
--- a/crypto/test/src/openpgp/test/PgpUnicodeTest.cs
+++ b/crypto/test/src/openpgp/test/PgpUnicodeTest.cs
@@ -2,7 +2,6 @@
 using System.IO;
 using System.Text;
 
-using NUnit.Core;
 using NUnit.Framework;
 
 using Org.BouncyCastle.Math;
@@ -123,7 +122,8 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             return new PgpSecretKeyRingBundle(SimpleTest.GetTestDataAsStream("openpgp.unicode." + keyName));
         }
 
-        public static void Main(string[] args)
+#if !LIB
+        public static void MainOld(string[] args)
         {
             Suite.Run(new NullListener(), NUnit.Core.TestFilter.Empty);
         }
@@ -138,5 +138,6 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
                 return suite;
             }
         }
+#endif
     }
 }
diff --git a/crypto/test/src/openpgp/test/RegressionTest.cs b/crypto/test/src/openpgp/test/RegressionTest.cs
index 329960bd8..7a68be55e 100644
--- a/crypto/test/src/openpgp/test/RegressionTest.cs
+++ b/crypto/test/src/openpgp/test/RegressionTest.cs
@@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
             new PgpParsingTest(),
         };
 
-        public static void Main(
+        public static void MainOld(
             string[] args)
         {
             foreach (ITest test in tests)