Files
mono/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransformTest.cs
T
Gert Driesen 19098dd864 * XmlDsigXsltTranformTest.cs: Added test for .ctor (bool).
* XmlDsigEnvelopedTransformTest.cs: Added test for .ctor (bool). Use
Assert class. Improved properties tests.
* XmlDsigC14TransformTest.cs: Added test for .ctor (bool).
* XmlDsigExcC14NTransformTest.cs: Added .ctor tests and added asserts
IncludsiveNamespacesPrefixList
* XmlDsigExcC14NWithCommentsTransformTest.cs: Added basic .ctor and
properties tests.
* XmlDsigC14NWithCommentsTransformTest.cs: Fixed line endings.
* XmlLicenseTransformTest.cs: Added basic .ctor and properties tests.
* XmlDsigBase64Transform.cs: Use constant for Algorithm namespace.
* XmlDsigExcC14NTransform.cs: Fixed ctors to use WithComments
algorithm if includeComments is true. Assign includeNamespacesPrefixList
to instance field.
* XmlDsigExcC14NWithCommentsTransform.cs: Remove unnecessary
assignment to Algorithm now that base ctor is fixed.
* XmlDsigC14NWithCommentsTransform.cs: Remove unnecessary assignment
to Algorithm now that base ctor is fixed.
* XmlDsigC14NTransform.cs: In default ctor, just invoke .ctor (bool).
In .ctor (bool), assign WithComments algorithm if includeComments is
true. Use constants for Algorithm namespace.
* XmlDsigEnvelopedSignatureTransform.cs: Use constant for Algorithm
namespace.
* XmlDsigXPathTransform.cs: Use constant for Algorithm namespace.
* XmlDsigXsltTransform.cs: Use constant for Algorithm namespace.
* XmlLicenseTransform.cs: Assign Algorithm in ctor.
* XmlSignature.cs: Added constant for XmlLicenseTransform algorithm.
* System.Security_test.dll.sources: Added XmlLicenseTransformTest.cs
and XmlDsigExcC14NWithCommentsTransformTest.cs.

svn path=/trunk/mcs/; revision=115803
2008-10-14 18:33:13 +00:00

144 lines
3.8 KiB
C#

//
// XmlDsigExcC14NWithCommentsTransformTest.cs - NUnit Test Cases for
// XmlDsigExcC14NWithCommentsTransform
//
// Author:
// original:
// Sebastien Pouliot <[email protected]>
// Aleksey Sanin ([email protected])
// this file:
// Gert Driesen <[email protected]>
//
// (C) 2003 Aleksey Sanin ([email protected])
// (C) 2004 Novell (http://www.novell.com)
// (C) 2008 Gert Driesen
//
#if NET_2_0
using System;
using System.IO;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.Security.Cryptography.Xml {
public class UnprotectedXmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NWithCommentsTransform {
public UnprotectedXmlDsigExcC14NWithCommentsTransform ()
{
}
public UnprotectedXmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)
: base (inclusiveNamespacesPrefixList)
{
}
public XmlNodeList UnprotectedGetInnerXml ()
{
return base.GetInnerXml ();
}
}
[TestFixture]
public class XmlDsigExcC14NWithCommentsTransformTest {
private UnprotectedXmlDsigExcC14NWithCommentsTransform transform;
[SetUp]
public void SetUp ()
{
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
}
[Test] // ctor ()
public void Constructor1 ()
{
CheckProperties (transform);
Assert.IsNull (transform.InclusiveNamespacesPrefixList);
}
[Test] // ctor (Boolean)
public void Constructor2 ()
{
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform (null);
CheckProperties (transform);
Assert.IsNull (transform.InclusiveNamespacesPrefixList);
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform (string.Empty);
CheckProperties (transform);
Assert.AreEqual (string.Empty, transform.InclusiveNamespacesPrefixList);
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ("#default xsd");
CheckProperties (transform);
Assert.AreEqual ("#default xsd", transform.InclusiveNamespacesPrefixList);
}
void CheckProperties (XmlDsigExcC14NWithCommentsTransform transform)
{
Assert.AreEqual ("http://www.w3.org/2001/10/xml-exc-c14n#WithComments",
transform.Algorithm, "Algorithm");
Type[] input = transform.InputTypes;
Assert.AreEqual (3, input.Length, "Input #");
// check presence of every supported input types
bool istream = false;
bool ixmldoc = false;
bool ixmlnl = false;
foreach (Type t in input) {
if (t == typeof (Stream))
istream = true;
if (t == typeof (XmlDocument))
ixmldoc = true;
if (t == typeof (XmlNodeList))
ixmlnl = true;
}
Assert.IsTrue (istream, "Input Stream");
Assert.IsTrue (ixmldoc, "Input XmlDocument");
Assert.IsTrue (ixmlnl, "Input XmlNodeList");
Type[] output = transform.OutputTypes;
Assert.AreEqual (1, output.Length, "Output #");
Assert.AreEqual (typeof (Stream), output [0], "Output Type");
}
[Test]
public void InputTypes ()
{
Type [] input = transform.InputTypes;
input [0] = null;
input [1] = null;
input [2] = null;
// property does not return a clone
foreach (Type t in transform.InputTypes)
Assert.IsNull (t);
// it's not a static array
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
foreach (Type t in transform.InputTypes)
Assert.IsNotNull (t);
}
[Test]
public void GetInnerXml ()
{
XmlNodeList xnl = transform.UnprotectedGetInnerXml ();
Assert.IsNull (xnl, "Default InnerXml");
}
[Test]
public void OutputTypes ()
{
// property does not return a clone
transform.OutputTypes [0] = null;
Assert.IsNull (transform.OutputTypes [0]);
// it's not a static array
transform = new UnprotectedXmlDsigExcC14NWithCommentsTransform ();
Assert.IsNotNull (transform.OutputTypes [0]);
}
}
}
#endif