Merge pull request #337 from robwilkens/IdleThreadsFixes
[mono.git] / mcs / class / System.Security / Test / System.Security.Cryptography.Xml / XmlLicenseTransformTest.cs
1 //
2 // XmlLicenseTransformTest.cs - NUnit Test Cases for XmlLicenseTransform
3 //
4 // Author:
5 //  original:
6 //      Sebastien Pouliot <sebastien@ximian.com>
7 //      Aleksey Sanin (aleksey@aleksey.com)
8 //  this file:
9 //      Gert Driesen <drieseng@users.sourceforge.net>
10 //
11 // (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
12 // (C) 2004 Novell (http://www.novell.com)
13 // (C) 2008 Gert Driesen
14 //
15
16 #if NET_2_0
17
18 using System;
19 using System.IO;
20 using System.Security.Cryptography.Xml;
21 using System.Text;
22 using System.Xml;
23
24 using NUnit.Framework;
25
26 namespace MonoTests.System.Security.Cryptography.Xml {
27         public class UnprotectedXmlLicenseTransform : XmlLicenseTransform {
28                 public XmlNodeList UnprotectedGetInnerXml ()
29                 {
30                         return base.GetInnerXml ();
31                 }
32         }
33
34         [TestFixture]
35         public class XmlLicenseTransformTest {
36                 private UnprotectedXmlLicenseTransform transform;
37
38                 [SetUp]
39                 public void SetUp ()
40                 {
41                         transform = new UnprotectedXmlLicenseTransform ();
42                 }
43
44                 [Test] // ctor ()
45                 public void Constructor1 ()
46                 {
47                         Assert.AreEqual ("urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform",
48                                 transform.Algorithm, "Algorithm");
49                         Assert.IsNull (transform.Decryptor, "Decryptor");
50
51                         Type[] input = transform.InputTypes;
52                         Assert.AreEqual (1, input.Length, "Input #");
53                         Assert.AreEqual (typeof (XmlDocument), input [0], "Input Type");
54
55                         Type[] output = transform.OutputTypes;
56                         Assert.AreEqual (1, output.Length, "Output #");
57                         Assert.AreEqual (typeof (XmlDocument), output [0], "Output Type");
58                 }
59
60                 [Test]
61                 public void InputTypes ()
62                 {
63                         // property does not return a clone
64                         transform.InputTypes [0] = null;
65                         Assert.IsNull (transform.InputTypes [0]);
66
67                         // it's not a static array
68                         transform = new UnprotectedXmlLicenseTransform ();
69                         Assert.IsNotNull (transform.InputTypes [0]);
70                 }
71
72                 [Test]
73                 public void GetInnerXml ()
74                 {
75                         XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
76                         Assert.IsNull (xnl, "Default InnerXml");
77                 }
78
79                 [Test]
80                 public void OutputTypes ()
81                 {
82                         // property does not return a clone
83                         transform.OutputTypes [0] = null;
84                         Assert.IsNull (transform.OutputTypes [0], "#1");
85
86                         // it's not a static array
87                         transform = new UnprotectedXmlLicenseTransform ();
88                         Assert.IsNotNull (transform.OutputTypes [0], "#2");
89                 }
90         }
91 }
92
93 #endif