XmlLicenseTransformTest.cs 2.2 KB

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