XmlLicenseTransformTest.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #if NET_2_0
  16. using System;
  17. using System.IO;
  18. using System.Security.Cryptography.Xml;
  19. using System.Text;
  20. using System.Xml;
  21. using NUnit.Framework;
  22. namespace MonoTests.System.Security.Cryptography.Xml {
  23. public class UnprotectedXmlLicenseTransform : XmlLicenseTransform {
  24. public XmlNodeList UnprotectedGetInnerXml ()
  25. {
  26. return base.GetInnerXml ();
  27. }
  28. }
  29. [TestFixture]
  30. public class XmlLicenseTransformTest {
  31. private UnprotectedXmlLicenseTransform transform;
  32. [SetUp]
  33. public void SetUp ()
  34. {
  35. transform = new UnprotectedXmlLicenseTransform ();
  36. }
  37. [Test] // ctor ()
  38. public void Constructor1 ()
  39. {
  40. Assert.AreEqual ("urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform",
  41. transform.Algorithm, "Algorithm");
  42. Assert.IsNull (transform.Decryptor, "Decryptor");
  43. Type[] input = transform.InputTypes;
  44. Assert.AreEqual (1, input.Length, "Input #");
  45. Assert.AreEqual (typeof (XmlDocument), input [0], "Input Type");
  46. Type[] output = transform.OutputTypes;
  47. Assert.AreEqual (1, output.Length, "Output #");
  48. Assert.AreEqual (typeof (XmlDocument), output [0], "Output Type");
  49. }
  50. [Test]
  51. public void InputTypes ()
  52. {
  53. // property does not return a clone
  54. transform.InputTypes [0] = null;
  55. Assert.IsNull (transform.InputTypes [0]);
  56. // it's not a static array
  57. transform = new UnprotectedXmlLicenseTransform ();
  58. Assert.IsNotNull (transform.InputTypes [0]);
  59. }
  60. [Test]
  61. public void GetInnerXml ()
  62. {
  63. XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
  64. Assert.IsNull (xnl, "Default InnerXml");
  65. }
  66. [Test]
  67. public void OutputTypes ()
  68. {
  69. // property does not return a clone
  70. transform.OutputTypes [0] = null;
  71. Assert.IsNull (transform.OutputTypes [0], "#1");
  72. // it's not a static array
  73. transform = new UnprotectedXmlLicenseTransform ();
  74. Assert.IsNotNull (transform.OutputTypes [0], "#2");
  75. }
  76. }
  77. }
  78. #endif