Fix old test cases so it's easier to reuse for the mobile profile / nunitlite
authorSebastien Pouliot <sebastien@xamarin.com>
Fri, 23 Mar 2012 00:34:34 +0000 (20:34 -0400)
committerSebastien Pouliot <sebastien@xamarin.com>
Fri, 23 Mar 2012 00:34:34 +0000 (20:34 -0400)
23 files changed:
mcs/class/corlib/Test/System.Security.Cryptography/CryptoStreamTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/DSACryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureDeformatterTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/DSASignatureFormatterTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACMD5Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACRIPEMD160Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA1Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA256Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA384Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HMACSHA512Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/HashAlgorithmTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/KeyedHashAlgorithmTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/PasswordDeriveBytesTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/RNGCryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA1CryptoServiceProviderTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA1Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA256ManagedTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA256Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA384ManagedTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA384Test.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA512ManagedTest.cs
mcs/class/corlib/Test/System.Security.Cryptography/SHA512Test.cs

index 580fac8e10750c2f4695a3949877b601f1337861..10328b8e60fa59ba34c76298cae2bbb000b0e58c 100644 (file)
@@ -331,7 +331,8 @@ namespace MonoTests.System.Security.Cryptography {
                                Assert.AreEqual (0, cs.Read (buffer, 0, 8), "Read from disposed");
                        }
                }
-
+               
+#if !NET_2_1
                [Test]
                // MS BUG [ExpectedException (typeof (ObjectDisposedException))]
 #if NET_2_0
@@ -353,6 +354,7 @@ namespace MonoTests.System.Security.Cryptography {
                                len = cs.Read (buffer, 3, 4);
                        }
                }
+#endif
 
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
@@ -433,7 +435,8 @@ namespace MonoTests.System.Security.Cryptography {
                        cs = new CryptoStream (readStream, encryptor, CryptoStreamMode.Read);
                        cs.Read (buffer, Int32.MaxValue, 4);
                }
-
+               
+#if !NET_2_1
                [Test]
                // MS BUG [ExpectedException (typeof (ObjectDisposedException))]
 #if NET_2_0
@@ -453,7 +456,8 @@ namespace MonoTests.System.Security.Cryptography {
                                cs.Write (buffer, 0, 8);
                        }
                }
-
+#endif
+               
                [Test]
                [ExpectedException (typeof (NotSupportedException))]
                public void Write_ReadStream () 
index a15a9b83952d0c379aaa36d7b3c563cf1181d434..727b13cdaa00cd184e3574beee86c0eadd18bebf 100644 (file)
@@ -48,8 +48,7 @@ public class DSACryptoServiceProviderTest {
 
        private bool machineKeyStore;
 
-       [TestFixtureSetUp]
-       public void FixtureSetUp () 
+       public DSACryptoServiceProviderTest () 
        {
                disposed = new DSACryptoServiceProvider (minKeySize);
                // FX 2.0 beta 1 bug - we must use the key before clearing it
@@ -328,7 +327,8 @@ public class DSACryptoServiceProviderTest {
                // verify a signature based on a new just generated keypair
                Assert.IsFalse (emptyDSA.VerifySignature (hash, sign));
        }
-
+               
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")]
        public void ImportDisposed ()
@@ -338,6 +338,7 @@ public class DSACryptoServiceProviderTest {
                import.ImportParameters (AllTests.GetKey (false));
                // no exception from Fx 2.0 +
        }
+#endif
 
        [Test]
        [ExpectedException (typeof (ObjectDisposedException))]
@@ -864,7 +865,8 @@ public class DSACryptoServiceProviderTest {
                catch (UnauthorizedAccessException) {
                }
        }
-
+               
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")]
        public void CspKeyContainerInfo_NewKeypair ()
@@ -932,6 +934,7 @@ public class DSACryptoServiceProviderTest {
                Assert.IsFalse (info.Removable, "Removable");
                // info.UniqueKeyContainerName throws a CryptographicException at this stage
        }
+#endif
 
        [Test]
        public void ExportCspBlob_Full ()
index 069e348370a9b872461e49500ce97ef380b36910..d34d72b131f1a913704dd55b1ddb6fdf71aecc2a 100644 (file)
@@ -44,8 +44,7 @@ public class DSASignatureDeformatterTest {
        static byte[] sign = { 0x50, 0xd2, 0xb0, 0x8b, 0xcd, 0x5e, 0xb2, 0xc2, 0x35, 0x82, 0xd3, 0x76, 0x07, 0x79, 0xbb, 0x55, 0x98, 0x72, 0x43, 0xe8,
                               0x74, 0xc9, 0x35, 0xf8, 0xc9, 0xbd, 0x69, 0x2f, 0x08, 0x34, 0xfa, 0x5a, 0x59, 0x23, 0x2a, 0x85, 0x7b, 0xa3, 0xb3, 0x82 };
 
-       [TestFixtureSetUp]
-       public void FixtureSetUp () 
+       public DSASignatureDeformatterTest () 
        {
                // key generation is VERY long so one time is enough
                dsa = DSA.Create ();
index 14e060bc9e99e451b7ad6e5b37b0c246340a73ec..ef90ffeb9d646890e809ef695ccbcb47513e7557 100644 (file)
@@ -40,8 +40,7 @@ public class DSASignatureFormatterTest {
        protected static DSA dsa;
        protected static RSA rsa;
 
-       [TestFixtureSetUp]
-       public void FixtureSetUp () 
+       public DSASignatureFormatterTest () 
        {
                // key generation is VERY long so one time is enough
                dsa = DSA.Create ();
index 43a83db4f1b608552128eb3346f8e2ee48ee81b7..eb248213bb0dde3bb2aa32d626578be6f9d20fdd 100644 (file)
@@ -36,7 +36,7 @@ namespace MonoTests.System.Security.Cryptography {
                protected HMACMD5 algo;
 
                [SetUp]
-               protected override void SetUp () 
+               public override void SetUp () 
                {
                        algo = new HMACMD5 ();
                        algo.Key = new byte [8];
index 29bcf75bb3d7ae00f853448cdf33f48639412542..7a99bfdc3207120972131fdbac73e080d56d86e5 100644 (file)
@@ -52,7 +52,7 @@ namespace MonoTests.System.Security.Cryptography {
                protected HMACRIPEMD160 hmac;
 
                [SetUp]
-               protected override void SetUp () 
+               public override void SetUp () 
                {
                        hmac = new HMACRIPEMD160 ();
                        hmac.Key = new byte [8];
index 85b049ebf642a4d70ec496f5b55fb9054d0d2a79..0f769b2a6bf77c13068465cf70e118af2b62769d 100644 (file)
@@ -56,7 +56,7 @@ public class HMACSHA1Test : KeyedHashAlgorithmTest {
        protected HMACSHA1 algo;
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = HMACSHA1.Create ();
                (hash as KeyedHashAlgorithm).Key = new byte [8];
index 2ca198c702674e162a3209320c2cdf45f1c680dc..99216b043406263cbff1375c26c9f00c7e28e632 100644 (file)
@@ -36,7 +36,7 @@ namespace MonoTests.System.Security.Cryptography {
                protected HMACSHA256 algo;
 
                [SetUp]
-               protected override void SetUp () 
+               public override void SetUp () 
                {
                        algo = new HMACSHA256 ();
                        algo.Key = new byte [8];
index dac396f6f6dd90ea61d9d59234ce498c91c1e06b..115bdf30cc40f2f400002f373e0ed99bb91a980d 100644 (file)
@@ -48,7 +48,7 @@ namespace MonoTests.System.Security.Cryptography {
                private bool legacy;
 
                [SetUp]
-               protected override void SetUp () 
+               public override void SetUp () 
                {
                        algo = new HMACSHA384 ();
                        algo.Key = new byte [8];
index fffd25944be1fd22fd3e8d699ac8a4f60647d282..dab2b8841b1a65b3ff1b87a528a3f919a87ba88b 100644 (file)
@@ -48,7 +48,7 @@ namespace MonoTests.System.Security.Cryptography {
                private bool legacy;
 
                [SetUp]
-               protected override void SetUp () 
+               public override void SetUp () 
                {
                        algo = new HMACSHA512 ();
                        algo.Key = new byte [8];
index ced7d28f4426421660164a56d28b69aec1cf4983..9feea2b3385acd7eb8e93b514d86293ed0adf85e 100644 (file)
@@ -44,7 +44,7 @@ public class HashAlgorithmTest {
        protected HashAlgorithm hash;
 
        [SetUp]
-       protected virtual void SetUp () 
+       public virtual void SetUp () 
        {
                hash = HashAlgorithm.Create ();
        }
@@ -356,7 +356,7 @@ public class HashAlgorithmTest {
        public virtual bool ManagedHashImplementation {
                get { return false; }
        }
-
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // Mono nevers throws an exception (and we're all managed ;-)
        public void TransformFinalBlock_Twice ()
@@ -394,7 +394,7 @@ public class HashAlgorithmTest {
                if (!ManagedHashImplementation && !exception)
                        Assert.Fail ("Expected CryptographicException from non *Managed classes");
        }
-
+#endif
        [Test]
        public void TransformFinalBlock_Twice_Initialize ()
        {
@@ -435,7 +435,7 @@ public class HashAlgorithmTest {
        {
                Assert.AreEqual (HashBuffer (false), HashBuffer (true), "Intersect");
        }
-
+#if !NET_2_1
        [Test]
        [ExpectedException (typeof (NullReferenceException))]
        [Category ("NotWorking")] // initialization problem ? fx2.0 only ?
@@ -445,7 +445,7 @@ public class HashAlgorithmTest {
                // getting the property throws
                Assert.IsNull (hash.Hash);
        }
-
+#endif
        [Test]
        [ExpectedException (typeof (CryptographicUnexpectedOperationException))]
        public void Hash_AfterInitialize_SecondTime ()
index 5b972d197a769c562fc09e84d9efec09ae08dcc0..7bd79f62e9b2cf114473fb5d35b13d68b02f8d2a 100644 (file)
@@ -22,7 +22,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class KeyedHashAlgorithmTest : HashAlgorithmTest {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = KeyedHashAlgorithm.Create ();
                (hash as KeyedHashAlgorithm).Key = new byte [8];
index 9002665f2b3e2d2b9ab92122700e024111288d29..39ab03b052e712c575f98bcfbfbc751610d65e64 100644 (file)
@@ -85,6 +85,7 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, new CspParameters ());
        }
 
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltNullCspParameters ()
@@ -94,6 +95,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (100, pdb.IterationCount, "IterationCount");
                Assert.IsNull (pdb.Salt, "Salt");
        }
+#endif
 
        [Test]
        public void Ctor_PasswordSaltCspParametersNull ()
@@ -104,6 +106,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
 
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltCspParameters ()
@@ -113,6 +116,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (100, pdb.IterationCount, "IterationCount");
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
+#endif
 
        [Test]
 #if NET_2_0
@@ -184,6 +188,7 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes (pwd, salt, "SHA1", 1, new CspParameters ());
        }
 
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltNullHashIterationCspParameters ()
@@ -193,6 +198,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (1, pdb.IterationCount, "IterationCount");
                Assert.IsNull (pdb.Salt, "Salt");
        }
+#endif
 
        [Test]
        [ExpectedException (typeof (ArgumentNullException))]
@@ -214,7 +220,8 @@ public class PasswordDeriveBytesTest {
        {
                PasswordDeriveBytes pdb = new PasswordDeriveBytes ("s3kr3t", salt, "SHA1", 0, new CspParameters ());
        }
-
+               
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltHashIterationMaxValueCspParameters ()
@@ -224,6 +231,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (Int32.MaxValue, pdb.IterationCount, "IterationCount");
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
+#endif
 
        [Test]
        public void Ctor_PasswordSaltHashIterationCspParametersNull ()
@@ -234,6 +242,7 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
 
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // CspParameters aren't supported by Mono (requires CryptoAPI)
        public void Ctor_PasswordSaltHashIterationCspParameters ()
@@ -243,7 +252,8 @@ public class PasswordDeriveBytesTest {
                Assert.AreEqual (1, pdb.IterationCount, "IterationCount");
                Assert.AreEqual (ssalt, BitConverter.ToString (pdb.Salt), "Salt");
        }
-
+#endif
+               
        // Properties
 
        [Test]
@@ -724,7 +734,8 @@ public class PasswordDeriveBytesTest {
                PasswordDeriveBytes pd = new PasswordDeriveBytes ("password", null, "MD5", 1000);
                pd.CryptDeriveKey ("AlgName", "MD5", 256, new byte [8]);
        }
-
+               
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")] // bug #79499
        public void LongMultipleGetBytes ()
@@ -739,6 +750,7 @@ public class PasswordDeriveBytesTest {
                // bytes from 32-40 are different from calling GetBytes separately
                Assert.AreEqual (key + "-F6-55-6C-3E-54-8B-F3-73-4D-3F-9B-F8-EE-AA-95-ED", BitConverter.ToString (pd.GetBytes (48)), "same");
        }
+#endif
 }
 
 }
index acef2f72b495ab67aff1ab25f85ae83f05ddf904..6f351c4edd0c804aaa675032c5e949a3ff8e04d8 100644 (file)
@@ -25,7 +25,7 @@ namespace MonoTests.System.Security.Cryptography {
                {
                        _algo = new RNGCryptoServiceProvider ();
                }
-
+#if !NET_2_1
                [Test]
                public void ConstructorByteArray () 
                {
@@ -62,7 +62,7 @@ namespace MonoTests.System.Security.Cryptography {
                        string s = null;
                        RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider (s);
                }
-
+#endif
                [Test]
                public void GetBytes () 
                {
index e7027510527e52454b6f53fa81413f7459826cb6..3742d1dba9d458cae3c1dec375bf3f9ecc3de20e 100644 (file)
@@ -45,8 +45,7 @@ public class RSACryptoServiceProviderTest : Assertion {
 
        private bool machineKeyStore;
 
-       [TestFixtureSetUp]
-       public void FixtureSetUp () 
+       public RSACryptoServiceProviderTest () 
        {
                sha1OID = CryptoConfig.MapNameToOID ("SHA1");
                disposed = new RSACryptoServiceProvider (minKeySize);
@@ -415,7 +414,7 @@ public class RSACryptoServiceProviderTest : Assertion {
                rsa.VerifyHash (hash, "1.3.14.3.2.26", null);
        }
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
        [Test]
        [Category ("NotWorking")]
        public void ImportDisposed ()
@@ -1151,6 +1150,7 @@ public class RSACryptoServiceProviderTest : Assertion {
        }
 
 #if NET_2_0
+#if !NET_2_1
        [Test]
        [Category ("NotWorking")]
        public void CspKeyContainerInfo_NewKeypair ()
@@ -1212,7 +1212,7 @@ public class RSACryptoServiceProviderTest : Assertion {
                Assert ("Removable", !info.Removable);
                // info.UniqueKeyContainerName throws a CryptographicException at this stage
        }
-
+#endif
        [Test]
        public void ExportCspBlob_Full () 
        {
index e316e858c0c92a26324a2469a1881aabba4b8193..882117029b098693941020f4510c5cfda4bebc0d 100644 (file)
@@ -26,7 +26,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA1CryptoServiceProviderTest : SHA1Test {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = new SHA1CryptoServiceProvider ();
        }
index d69675c29f2db292779b683386c376c6a9c0466d..c32ae11ba27c48dfd5a1d9bd36e9a8177704e06b 100644 (file)
@@ -28,7 +28,7 @@ namespace MonoTests.System.Security.Cryptography
 public class SHA1Test : HashAlgorithmTest {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = SHA1.Create ();
        }
index e89593972f67223d573b8dad0db9ad2cf90b75e7..4247d7a9f946186fdb8aee273e082e9e100b3b18 100644 (file)
@@ -26,7 +26,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA256ManagedTest : SHA256Test {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = new SHA256Managed ();
        }
index a6f574e51e758611ba82e16971e59c2e100084a3..88a3dee98367b71720ab812d2bc302940a27e154 100644 (file)
@@ -27,7 +27,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA256Test : HashAlgorithmTest {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = SHA256.Create ();
        }
index dc302ecc30e95efcc4ec62eb5de65fdbf688a5b8..a0beba883839d47f7535ec145127ea7a25d30ba1 100644 (file)
@@ -26,7 +26,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA384ManagedTest : SHA384Test {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = new SHA384Managed ();
        }
index fa5dc6160c590c60c29c9aae887c886ece4f368f..2c98fdfe25828e26c28a441ae55f7065d402c7df 100644 (file)
@@ -27,7 +27,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA384Test : HashAlgorithmTest {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = SHA384.Create ();
        }
index a204691bdf1ad77c365dc2f0dda22c1b571a9194..b372affad2940be0fac04290d4f9142a7567b884 100644 (file)
@@ -26,7 +26,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA512ManagedTest : SHA512Test {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = new SHA512Managed ();
        }
index 4ea92dd70634dd179b872aa02d373e95232ed41d..a8096271ad5f298d8484e9262642bf015c4a52fb 100644 (file)
@@ -27,7 +27,7 @@ namespace MonoTests.System.Security.Cryptography {
 public class SHA512Test : HashAlgorithmTest {
 
        [SetUp]
-       protected override void SetUp () 
+       public override void SetUp () 
        {
                hash = SHA512.Create ();
        }