2004-05-06 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / corlib / Test / System.Security.Cryptography / AsymmetricAlgorithmTest.cs
1 //\r
2 // TestSuite.System.Security.Cryptography.AsymmetricAlgorithmTest.cs\r
3 //\r
4 // Author:\r
5 //      Thomas Neidhart (tome@sbox.tugraz.at)\r
6 //\r
7 \r
8 \r
9 using System;\r
10 using System.Security.Cryptography;\r
11 \r
12 using NUnit.Framework;\r
13 \r
14 namespace MonoTests.System.Security.Cryptography {\r
15 \r
16         public class AsymmetricAlgorithmTest : TestCase {\r
17                 private AsymmetricAlgorithm _algo;\r
18                 protected override void SetUp() {\r
19                         _algo = AsymmetricAlgorithm.Create();\r
20                 }\r
21 \r
22                 private void SetDefaultData() {\r
23                 }\r
24                 \r
25                 public void TestProperties() {\r
26                         Assert("Properties (1)", _algo != null);\r
27                         \r
28                         bool thrown = false;\r
29                         try {\r
30                                 KeySizes[] keys = _algo.LegalKeySizes;\r
31                                 foreach (KeySizes myKey in keys) {\r
32                                         for (int i=myKey.MinSize; i<=myKey.MaxSize; i+=myKey.SkipSize) {\r
33                                                 _algo.KeySize = i;\r
34                                         }\r
35                                 }\r
36                         } catch (CryptographicException) {thrown=true;}\r
37                         Assert("Properties (2)", !thrown);                      \r
38                 }\r
39         }\r
40 }\r