Browse Source

2005-10-24 Sebastien Pouliot <[email protected]>

	* CodeArgumentReferenceExpressionCas.cs, 
	CodeArrayCreateExpressionCas.cs, CodeArrayIndexerExpressionCas.cs,
	CodeAssignStatementCas.cs, CodeAttachEventStatementCas.cs,
	CodeAttributeArgumentCas.cs, CodeAttributeArgumentCollectionCas.cs,
	CodeAttributeDeclarationCas.cs, 
	CodeAttributeDeclarationCollectionCas.cs, 
	CodeBaseReferenceExpressionCas.cs, CodeBinaryOperatorExpressionCas.cs,
	CodeCastExpressionCas.cs, CodeCatchClauseCas.cs,
	CodeCatchClauseCollectionCas.cs, CodeChecksumPragmaCas.cs,
	CodeCommentStatementCas.cs, CodeCommentStatementCollectionCas.cs,
	CodeCompileUnitCas.cs, CodeConditionStatementCas.cs,
	CodeConstructorCas.cs, CodeDefaultValueExpressionCas.cs,
	CodeDelegateCreateExpressionCas.cs, 
	CodeDelegateInvokeExpressionCas.cs, CodeDirectionExpressionCas.cs,
	CodeDirectiveCas.cs, CodeDirectiveCollectionCas.cs,
	CodeEntryPointMethodCas.cs, CodeEventReferenceExpressionCas.cs,
	CodeExpressionCas.cs, CodeExpressionCollectionCas.cs, 
	CodeExpressionStatementCas.cs, CodeFieldReferenceExpressionCas.cs,
	CodeGotoStatementCas.cs, CodeIndexerExpressionCas.cs,
	CodeIterationStatementCas.cs, CodeLinePragmaCas.cs,
	CodeMemberEventCas.cs, CodeMemberFieldCas.cs, CodeMemberMethodCas.cs,
	CodeMemberPropertyCas.cs, CodeMethodInvokeExpressionCas.cs,
	CodeMethodReferenceExpressionCas.cs, CodeMethodReturnStatementCas.cs,
	CodeNamespaceCas.cs, CodeNamespaceCollectionCas.cs,
	CodeNamespaceImportCas.cs, CodeNamespaceImportCollectionCas.cs,
	CodeObjectCas.cs, CodeObjectCreateExpressionCas.cs,
	CodeParameterDeclarationExpressionCas.cs,
	CodeParameterDeclarationExpressionCollectionCas.cs,
	CodePrimitiveExpressionCas.cs, CodePropertyReferenceExpressionCas.cs,
	CodePropertySetValueReferenceExpressionCas.cs,
	CodeRegionDirectiveCas.cs, CodeRemoveEventStatementCas.cs,
	CodeSnippetCompileUnitCas.cs, CodeSnippetExpressionCas.cs,
	CodeSnippetStatementCas.cs, CodeSnippetTypeMemberCas.cs,
	CodeStatementCas.cs, CodeStatementCollectionCas.cs,
	CodeThisReferenceExpressionCas.cs, CodeThrowExceptionStatementCas.cs,
	CodeTryCatchFinallyStatementCas.cs, CodeTypeConstructorCas.cs,
	CodeTypeDeclarationCas.cs, CodeTypeDeclarationCollectionCas.cs,
	CodeTypeDelegateCas.cs, CodeTypeMemberCas.cs, 
	CodeTypeMemberCollectionCas.cs, CodeTypeOfExpressionCas.cs,
	CodeTypeParameterCas.cs, CodeTypeReferenceCas.cs,
	CodeTypeReferenceCollectionCas.cs, CodeTypeReferenceExpressionCas.cs,
	CodeVariableDeclarationStatementCas.cs,
	CodeVariableReferenceExpressionCas.cs: New. CAS unit tests.


svn path=/trunk/mcs/; revision=52125
Sebastien Pouliot 20 years ago
parent
commit
d696ee55ac
79 changed files with 7443 additions and 0 deletions
  1. 46 0
      mcs/class/System/Test/System.CodeDom/ChangeLog
  2. 78 0
      mcs/class/System/Test/System.CodeDom/CodeArgumentReferenceExpressionCas.cs
  3. 188 0
      mcs/class/System/Test/System.CodeDom/CodeArrayCreateExpressionCas.cs
  4. 82 0
      mcs/class/System/Test/System.CodeDom/CodeArrayIndexerExpressionCas.cs
  5. 84 0
      mcs/class/System/Test/System.CodeDom/CodeAssignStatementCas.cs
  6. 100 0
      mcs/class/System/Test/System.CodeDom/CodeAttachEventStatementCas.cs
  7. 95 0
      mcs/class/System/Test/System.CodeDom/CodeAttributeArgumentCas.cs
  8. 119 0
      mcs/class/System/Test/System.CodeDom/CodeAttributeArgumentCollectionCas.cs
  9. 125 0
      mcs/class/System/Test/System.CodeDom/CodeAttributeDeclarationCas.cs
  10. 119 0
      mcs/class/System/Test/System.CodeDom/CodeAttributeDeclarationCollectionCas.cs
  11. 67 0
      mcs/class/System/Test/System.CodeDom/CodeBaseReferenceExpressionCas.cs
  12. 89 0
      mcs/class/System/Test/System.CodeDom/CodeBinaryOperatorExpressionCas.cs
  13. 84 0
      mcs/class/System/Test/System.CodeDom/CodeCastExpressionCas.cs
  14. 111 0
      mcs/class/System/Test/System.CodeDom/CodeCatchClauseCas.cs
  15. 119 0
      mcs/class/System/Test/System.CodeDom/CodeCatchClauseCollectionCas.cs
  16. 89 0
      mcs/class/System/Test/System.CodeDom/CodeChecksumPragmaCas.cs
  17. 96 0
      mcs/class/System/Test/System.CodeDom/CodeCommentStatementCas.cs
  18. 119 0
      mcs/class/System/Test/System.CodeDom/CodeCommentStatementCollectionCas.cs
  19. 74 0
      mcs/class/System/Test/System.CodeDom/CodeCompileUnitCas.cs
  20. 98 0
      mcs/class/System/Test/System.CodeDom/CodeConditionStatementCas.cs
  21. 69 0
      mcs/class/System/Test/System.CodeDom/CodeConstructorCas.cs
  22. 83 0
      mcs/class/System/Test/System.CodeDom/CodeDefaultValueExpressionCas.cs
  23. 89 0
      mcs/class/System/Test/System.CodeDom/CodeDelegateCreateExpressionCas.cs
  24. 93 0
      mcs/class/System/Test/System.CodeDom/CodeDelegateInvokeExpressionCas.cs
  25. 83 0
      mcs/class/System/Test/System.CodeDom/CodeDirectionExpressionCas.cs
  26. 71 0
      mcs/class/System/Test/System.CodeDom/CodeDirectiveCas.cs
  27. 123 0
      mcs/class/System/Test/System.CodeDom/CodeDirectiveCollectionCas.cs
  28. 67 0
      mcs/class/System/Test/System.CodeDom/CodeEntryPointMethodCas.cs
  29. 83 0
      mcs/class/System/Test/System.CodeDom/CodeEventReferenceExpressionCas.cs
  30. 67 0
      mcs/class/System/Test/System.CodeDom/CodeExpressionCas.cs
  31. 119 0
      mcs/class/System/Test/System.CodeDom/CodeExpressionCollectionCas.cs
  32. 77 0
      mcs/class/System/Test/System.CodeDom/CodeExpressionStatementCas.cs
  33. 83 0
      mcs/class/System/Test/System.CodeDom/CodeFieldReferenceExpressionCas.cs
  34. 79 0
      mcs/class/System/Test/System.CodeDom/CodeGotoStatementCas.cs
  35. 82 0
      mcs/class/System/Test/System.CodeDom/CodeIndexerExpressionCas.cs
  36. 92 0
      mcs/class/System/Test/System.CodeDom/CodeIterationStatementCas.cs
  37. 83 0
      mcs/class/System/Test/System.CodeDom/CodeLinePragmaCas.cs
  38. 72 0
      mcs/class/System/Test/System.CodeDom/CodeMemberEventCas.cs
  39. 105 0
      mcs/class/System/Test/System.CodeDom/CodeMemberFieldCas.cs
  40. 78 0
      mcs/class/System/Test/System.CodeDom/CodeMemberMethodCas.cs
  41. 79 0
      mcs/class/System/Test/System.CodeDom/CodeMemberPropertyCas.cs
  42. 96 0
      mcs/class/System/Test/System.CodeDom/CodeMethodInvokeExpressionCas.cs
  43. 103 0
      mcs/class/System/Test/System.CodeDom/CodeMethodReferenceExpressionCas.cs
  44. 79 0
      mcs/class/System/Test/System.CodeDom/CodeMethodReturnStatementCas.cs
  45. 100 0
      mcs/class/System/Test/System.CodeDom/CodeNamespaceCas.cs
  46. 119 0
      mcs/class/System/Test/System.CodeDom/CodeNamespaceCollectionCas.cs
  47. 86 0
      mcs/class/System/Test/System.CodeDom/CodeNamespaceImportCas.cs
  48. 111 0
      mcs/class/System/Test/System.CodeDom/CodeNamespaceImportCollectionCas.cs
  49. 68 0
      mcs/class/System/Test/System.CodeDom/CodeObjectCas.cs
  50. 104 0
      mcs/class/System/Test/System.CodeDom/CodeObjectCreateExpressionCas.cs
  51. 121 0
      mcs/class/System/Test/System.CodeDom/CodeParameterDeclarationExpressionCas.cs
  52. 119 0
      mcs/class/System/Test/System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs
  53. 79 0
      mcs/class/System/Test/System.CodeDom/CodePrimitiveExpressionCas.cs
  54. 83 0
      mcs/class/System/Test/System.CodeDom/CodePropertyReferenceExpressionCas.cs
  55. 67 0
      mcs/class/System/Test/System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs
  56. 86 0
      mcs/class/System/Test/System.CodeDom/CodeRegionDirectiveCas.cs
  57. 98 0
      mcs/class/System/Test/System.CodeDom/CodeRemoveEventStatementCas.cs
  58. 83 0
      mcs/class/System/Test/System.CodeDom/CodeSnippetCompileUnitCas.cs
  59. 78 0
      mcs/class/System/Test/System.CodeDom/CodeSnippetExpressionCas.cs
  60. 78 0
      mcs/class/System/Test/System.CodeDom/CodeSnippetStatementCas.cs
  61. 78 0
      mcs/class/System/Test/System.CodeDom/CodeSnippetTypeMemberCas.cs
  62. 73 0
      mcs/class/System/Test/System.CodeDom/CodeStatementCas.cs
  63. 119 0
      mcs/class/System/Test/System.CodeDom/CodeStatementCollectionCas.cs
  64. 67 0
      mcs/class/System/Test/System.CodeDom/CodeThisReferenceExpressionCas.cs
  65. 79 0
      mcs/class/System/Test/System.CodeDom/CodeThrowExceptionStatementCas.cs
  66. 95 0
      mcs/class/System/Test/System.CodeDom/CodeTryCatchFinallyStatementCas.cs
  67. 67 0
      mcs/class/System/Test/System.CodeDom/CodeTypeConstructorCas.cs
  68. 116 0
      mcs/class/System/Test/System.CodeDom/CodeTypeDeclarationCas.cs
  69. 119 0
      mcs/class/System/Test/System.CodeDom/CodeTypeDeclarationCollectionCas.cs
  70. 80 0
      mcs/class/System/Test/System.CodeDom/CodeTypeDelegateCas.cs
  71. 80 0
      mcs/class/System/Test/System.CodeDom/CodeTypeMemberCas.cs
  72. 119 0
      mcs/class/System/Test/System.CodeDom/CodeTypeMemberCollectionCas.cs
  73. 97 0
      mcs/class/System/Test/System.CodeDom/CodeTypeOfExpressionCas.cs
  74. 90 0
      mcs/class/System/Test/System.CodeDom/CodeTypeParameterCas.cs
  75. 197 0
      mcs/class/System/Test/System.CodeDom/CodeTypeReferenceCas.cs
  76. 119 0
      mcs/class/System/Test/System.CodeDom/CodeTypeReferenceCollectionCas.cs
  77. 97 0
      mcs/class/System/Test/System.CodeDom/CodeTypeReferenceExpressionCas.cs
  78. 156 0
      mcs/class/System/Test/System.CodeDom/CodeVariableDeclarationStatementCas.cs
  79. 78 0
      mcs/class/System/Test/System.CodeDom/CodeVariableReferenceExpressionCas.cs

+ 46 - 0
mcs/class/System/Test/System.CodeDom/ChangeLog

@@ -1,3 +1,49 @@
+2005-10-24  Sebastien Pouliot  <[email protected]>
+
+	* CodeArgumentReferenceExpressionCas.cs, 
+	CodeArrayCreateExpressionCas.cs, CodeArrayIndexerExpressionCas.cs,
+	CodeAssignStatementCas.cs, CodeAttachEventStatementCas.cs,
+	CodeAttributeArgumentCas.cs, CodeAttributeArgumentCollectionCas.cs,
+	CodeAttributeDeclarationCas.cs, 
+	CodeAttributeDeclarationCollectionCas.cs, 
+	CodeBaseReferenceExpressionCas.cs, CodeBinaryOperatorExpressionCas.cs,
+	CodeCastExpressionCas.cs, CodeCatchClauseCas.cs,
+	CodeCatchClauseCollectionCas.cs, CodeChecksumPragmaCas.cs,
+	CodeCommentStatementCas.cs, CodeCommentStatementCollectionCas.cs,
+	CodeCompileUnitCas.cs, CodeConditionStatementCas.cs,
+	CodeConstructorCas.cs, CodeDefaultValueExpressionCas.cs,
+	CodeDelegateCreateExpressionCas.cs, 
+	CodeDelegateInvokeExpressionCas.cs, CodeDirectionExpressionCas.cs,
+	CodeDirectiveCas.cs, CodeDirectiveCollectionCas.cs,
+	CodeEntryPointMethodCas.cs, CodeEventReferenceExpressionCas.cs,
+	CodeExpressionCas.cs, CodeExpressionCollectionCas.cs, 
+	CodeExpressionStatementCas.cs, CodeFieldReferenceExpressionCas.cs,
+	CodeGotoStatementCas.cs, CodeIndexerExpressionCas.cs,
+	CodeIterationStatementCas.cs, CodeLinePragmaCas.cs,
+	CodeMemberEventCas.cs, CodeMemberFieldCas.cs, CodeMemberMethodCas.cs,
+	CodeMemberPropertyCas.cs, CodeMethodInvokeExpressionCas.cs,
+	CodeMethodReferenceExpressionCas.cs, CodeMethodReturnStatementCas.cs,
+	CodeNamespaceCas.cs, CodeNamespaceCollectionCas.cs,
+	CodeNamespaceImportCas.cs, CodeNamespaceImportCollectionCas.cs,
+	CodeObjectCas.cs, CodeObjectCreateExpressionCas.cs,
+	CodeParameterDeclarationExpressionCas.cs,
+	CodeParameterDeclarationExpressionCollectionCas.cs,
+	CodePrimitiveExpressionCas.cs, CodePropertyReferenceExpressionCas.cs,
+	CodePropertySetValueReferenceExpressionCas.cs,
+	CodeRegionDirectiveCas.cs, CodeRemoveEventStatementCas.cs,
+	CodeSnippetCompileUnitCas.cs, CodeSnippetExpressionCas.cs,
+	CodeSnippetStatementCas.cs, CodeSnippetTypeMemberCas.cs,
+	CodeStatementCas.cs, CodeStatementCollectionCas.cs,
+	CodeThisReferenceExpressionCas.cs, CodeThrowExceptionStatementCas.cs,
+	CodeTryCatchFinallyStatementCas.cs, CodeTypeConstructorCas.cs,
+	CodeTypeDeclarationCas.cs, CodeTypeDeclarationCollectionCas.cs,
+	CodeTypeDelegateCas.cs, CodeTypeMemberCas.cs, 
+	CodeTypeMemberCollectionCas.cs, CodeTypeOfExpressionCas.cs,
+	CodeTypeParameterCas.cs, CodeTypeReferenceCas.cs,
+	CodeTypeReferenceCollectionCas.cs, CodeTypeReferenceExpressionCas.cs,
+	CodeVariableDeclarationStatementCas.cs,
+	CodeVariableReferenceExpressionCas.cs: New. CAS unit tests.
+
 2005-10-07  Gert Driesen  <[email protected]>
 
 	* CodeTypeReferenceTest.cs: Added tests for multi-dimensional

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeArgumentReferenceExpressionCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeArgumentReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeArgumentReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeArgumentReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void ConstructorEmpty_Deny_Unrestricted ()
+		{
+			CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ();
+			Assert.AreEqual (String.Empty, care.ParameterName, "ParameterName");
+			care.ParameterName = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void ConstructorString_Deny_Unrestricted ()
+		{
+			CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ("mono");
+			Assert.AreEqual ("mono", care.ParameterName, "ParameterName");
+			care.ParameterName = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeArgumentReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 188 - 0
mcs/class/System/Test/System.CodeDom/CodeArrayCreateExpressionCas.cs

@@ -0,0 +1,188 @@
+//
+// CodeArrayCreateExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeArrayCreateExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeArrayCreateExpressionCas {
+
+		private CodeTypeReference ctr;
+		private CodeExpression ce;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			// at fulltrust
+			ctr = new CodeTypeReference ("System.Void");
+			ce = new CodeExpression ();
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		private void CheckProperties (CodeArrayCreateExpression cace)
+		{
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression ();
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (ctr, ce);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.AreSame (ce, cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression[] parameters = new CodeExpression[1] { ce };
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (ctr, parameters);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (1, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (ctr, Int32.MinValue);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (Int32.MinValue, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor4_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression ("System.Void", ce);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.AreSame (ce, cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor5_Deny_Unrestricted ()
+		{
+			CodeExpression[] parameters = new CodeExpression[1] { ce };
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression ("System.Void", parameters);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (1, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor6_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression ("System.Void", Int32.MinValue);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (Int32.MinValue, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor7_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (typeof(void), ce);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.AreSame (ce, cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor8_Deny_Unrestricted ()
+		{
+			CodeExpression[] parameters = new CodeExpression[1] { ce };
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (typeof (void), parameters);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (1, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (0, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor9_Deny_Unrestricted ()
+		{
+			CodeArrayCreateExpression cace = new CodeArrayCreateExpression (typeof (void), Int32.MinValue);
+			Assert.AreEqual ("System.Void", cace.CreateType.BaseType, "CreateType.BaseType");
+			Assert.AreEqual (0, cace.Initializers.Count, "Initializers");
+			Assert.AreEqual (Int32.MinValue, cace.Size, "Size");
+			Assert.IsNull (cace.SizeExpression, "SizeExpression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeArrayCreateExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 82 - 0
mcs/class/System/Test/System.CodeDom/CodeArrayIndexerExpressionCas.cs

@@ -0,0 +1,82 @@
+//
+// CodeArrayIndexerExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeArrayIndexerExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeArrayIndexerExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeArrayIndexerExpression caie = new CodeArrayIndexerExpression ();
+			Assert.AreEqual (0, caie.Indices.Count, "Indices");
+			Assert.IsNull (caie.TargetObject, "TargetObject");
+			caie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeExpression[] parameters = new CodeExpression[1] { target };
+			CodeArrayIndexerExpression caie = new CodeArrayIndexerExpression (target, parameters);
+			Assert.AreEqual (1, caie.Indices.Count, "Indices");
+			Assert.AreSame (target, caie.TargetObject, "TargetObject");
+			caie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeArrayIndexerExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 84 - 0
mcs/class/System/Test/System.CodeDom/CodeAssignStatementCas.cs

@@ -0,0 +1,84 @@
+//
+// CodeAssignStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAssignStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAssignStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAssignStatement cas = new CodeAssignStatement ();
+			Assert.IsNull (cas.Left, "Left");
+			cas.Left = new CodeExpression ();
+			Assert.IsNull (cas.Right, "Right");
+			cas.Right = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression left = new CodeExpression ();
+			CodeExpression right = new CodeExpression ();
+			CodeAssignStatement cas = new CodeAssignStatement (left, right);
+			Assert.AreSame (left, cas.Left, "Left");
+			cas.Left = new CodeExpression ();
+			Assert.AreSame (right, cas.Right, "Right");
+			cas.Right = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAssignStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 100 - 0
mcs/class/System/Test/System.CodeDom/CodeAttachEventStatementCas.cs

@@ -0,0 +1,100 @@
+//
+// CodeAttachEventStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAttachEventStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAttachEventStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAttachEventStatement caes = new CodeAttachEventStatement ();
+			Assert.AreEqual (String.Empty, caes.Event.EventName, "Event.EventName");
+			Assert.IsNull (caes.Event.TargetObject, "Event.TargetObject");
+			caes.Event = new CodeEventReferenceExpression ();
+			Assert.IsNull (caes.Listener, "Listener");
+			caes.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeEventReferenceExpression eventref = new CodeEventReferenceExpression ();
+			CodeExpression listener = new CodeExpression ();
+			CodeAttachEventStatement caes = new CodeAttachEventStatement (eventref, listener);
+			Assert.AreSame (eventref, caes.Event, "Event");
+			caes.Event = new CodeEventReferenceExpression ();
+			Assert.AreSame (listener, caes.Listener, "Listener");
+			caes.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			string eventName = "Mono";
+			CodeExpression listener = new CodeExpression ();
+			CodeAttachEventStatement caes = new CodeAttachEventStatement (target, eventName, listener);
+			Assert.AreEqual (eventName, caes.Event.EventName, "Event.EventName");
+			Assert.AreSame (target, caes.Event.TargetObject, "Event.TargetObject");
+			caes.Event = new CodeEventReferenceExpression ();
+			Assert.AreSame (listener, caes.Listener, "Listener");
+			caes.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAttachEventStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 95 - 0
mcs/class/System/Test/System.CodeDom/CodeAttributeArgumentCas.cs

@@ -0,0 +1,95 @@
+//
+// CodeAttributeArgumentCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAttributeArgument
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAttributeArgumentCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAttributeArgument caa = new CodeAttributeArgument ();
+			Assert.AreEqual (String.Empty, caa.Name, "Name");
+			caa.Name = null;
+			Assert.IsNull (caa.Value, "Value");
+			caa.Value = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression value = new CodeExpression ();
+			CodeAttributeArgument caa = new CodeAttributeArgument (value);
+			Assert.AreEqual (String.Empty, caa.Name, "Name");
+			caa.Name = null;
+			Assert.AreSame (value, caa.Value, "Value");
+			caa.Value = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression value = new CodeExpression ();
+			CodeAttributeArgument caa = new CodeAttributeArgument ("mono", value);
+			Assert.AreEqual ("mono", caa.Name, "Name");
+			caa.Name = String.Empty;
+			Assert.AreSame (value, caa.Value, "Value");
+			caa.Value = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAttributeArgument).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeAttributeArgumentCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeAttributeArgumentCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAttributeArgumentCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAttributeArgumentCollectionCas {
+
+		private CodeAttributeArgument caa;
+		private CodeAttributeArgument[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			caa = new CodeAttributeArgument ();
+			array = new CodeAttributeArgument[1] { caa };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
+			Assert.AreEqual (0, coll.Add (caa), "Add");
+			Assert.AreSame (caa, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (caa), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (caa), "IndexOf");
+			coll.Insert (0, caa);
+			coll.Remove (caa);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (caa), "Add");
+			Assert.AreSame (caa, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (caa), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (caa), "IndexOf");
+			coll.Insert (0, caa);
+			coll.Remove (caa);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeAttributeArgumentCollection c = new CodeAttributeArgumentCollection ();
+			CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (c);
+			Assert.AreEqual (0, coll.Add (caa), "Add");
+			Assert.AreSame (caa, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (caa), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (caa), "IndexOf");
+			coll.Insert (0, caa);
+			coll.Remove (caa);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAttributeArgumentCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 125 - 0
mcs/class/System/Test/System.CodeDom/CodeAttributeDeclarationCas.cs

@@ -0,0 +1,125 @@
+//
+// CodeAttributeDeclarationCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAttributeDeclaration
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAttributeDeclarationCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAttributeDeclaration cad = new CodeAttributeDeclaration ();
+			Assert.AreEqual (0, cad.Arguments.Count, "Arguments");
+			Assert.AreEqual (String.Empty, cad.Name, "Name");
+			cad.Name = null;
+#if NET_2_0
+			Assert.AreEqual ("System.Void", cad.AttributeType.BaseType, "AttributeType.BaseType");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeAttributeDeclaration cad = new CodeAttributeDeclaration ("mono");
+			Assert.AreEqual (0, cad.Arguments.Count, "Arguments");
+			Assert.AreEqual ("mono", cad.Name, "Name");
+			cad.Name = null;
+#if NET_2_0
+			Assert.AreEqual ("System.Void", cad.AttributeType.BaseType, "AttributeType.BaseType");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeAttributeArgument[] args = new CodeAttributeArgument[1] { new CodeAttributeArgument () };
+			CodeAttributeDeclaration cad = new CodeAttributeDeclaration ("mono", args);
+			Assert.AreEqual (1, cad.Arguments.Count, "Arguments");
+			Assert.AreEqual ("mono", cad.Name, "Name");
+			cad.Name = null;
+#if NET_2_0
+			Assert.AreEqual ("System.Void", cad.AttributeType.BaseType, "AttributeType.BaseType");
+#endif
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Int32");
+			CodeAttributeDeclaration cad = new CodeAttributeDeclaration (ctr);
+			Assert.AreEqual (0, cad.Arguments.Count, "Arguments");
+			Assert.AreEqual ("System.Int32", cad.Name, "Name");
+			cad.Name = null;
+			Assert.AreEqual ("System.Void", cad.AttributeType.BaseType, "AttributeType.BaseType");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor4_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Int32");
+			CodeAttributeArgument[] args = new CodeAttributeArgument[1] { new CodeAttributeArgument () };
+			CodeAttributeDeclaration cad = new CodeAttributeDeclaration (ctr, args);
+			Assert.AreEqual (1, cad.Arguments.Count, "Arguments");
+			Assert.AreEqual ("System.Int32", cad.Name, "Name");
+			cad.Name = null;
+			Assert.AreEqual ("System.Void", cad.AttributeType.BaseType, "AttributeType.BaseType");
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAttributeDeclaration).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeAttributeDeclarationCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeAttributeDeclarationCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeAttributeDeclarationCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeAttributeDeclarationCollectionCas {
+
+		private CodeAttributeDeclaration cad;
+		private CodeAttributeDeclaration[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cad = new CodeAttributeDeclaration ();
+			array = new CodeAttributeDeclaration[1] { cad };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
+			Assert.AreEqual (0, coll.Add (cad), "Add");
+			Assert.AreSame (cad, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cad), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cad), "IndexOf");
+			coll.Insert (0, cad);
+			coll.Remove (cad);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (cad), "Add");
+			Assert.AreSame (cad, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cad), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cad), "IndexOf");
+			coll.Insert (0, cad);
+			coll.Remove (cad);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeAttributeDeclarationCollection c = new CodeAttributeDeclarationCollection ();
+			CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (c);
+			Assert.AreEqual (0, coll.Add (cad), "Add");
+			Assert.AreSame (cad, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cad), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cad), "IndexOf");
+			coll.Insert (0, cad);
+			coll.Remove (cad);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeAttributeDeclarationCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodeBaseReferenceExpressionCas.cs

@@ -0,0 +1,67 @@
+//
+// CodeBaseReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeBaseReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeBaseReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			new CodeBaseReferenceExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeBaseReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 89 - 0
mcs/class/System/Test/System.CodeDom/CodeBinaryOperatorExpressionCas.cs

@@ -0,0 +1,89 @@
+//
+// CodeBinaryOperatorExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeBinaryOperatorExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeBinaryOperatorExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeBinaryOperatorExpression cboe = new CodeBinaryOperatorExpression ();
+			Assert.IsNull (cboe.Left, "Left");
+			cboe.Left = new CodeExpression ();
+			Assert.IsNull (cboe.Right, "Right");
+			cboe.Right = new CodeExpression ();
+			Assert.AreEqual (CodeBinaryOperatorType.Add, cboe.Operator, "Operator");
+			cboe.Operator = CodeBinaryOperatorType.Divide;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression left = new CodeExpression ();
+			CodeExpression right = new CodeExpression ();
+			CodeBinaryOperatorExpression cboe = new CodeBinaryOperatorExpression (left, CodeBinaryOperatorType.Subtract, right);
+			Assert.AreSame (left, cboe.Left, "Left");
+			cboe.Left = new CodeExpression ();
+			Assert.AreSame (right, cboe.Right, "Right");
+			cboe.Right = new CodeExpression ();
+			Assert.AreEqual (CodeBinaryOperatorType.Subtract, cboe.Operator, "Operator");
+			cboe.Operator = CodeBinaryOperatorType.Multiply;
+		}
+
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeBinaryOperatorExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 84 - 0
mcs/class/System/Test/System.CodeDom/CodeCastExpressionCas.cs

@@ -0,0 +1,84 @@
+//
+// CodeCastExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCastExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCastExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCastExpression cce = new CodeCastExpression ();
+			Assert.IsNull (cce.Expression, "Expression");
+			cce.Expression = new CodeExpression ();
+			Assert.AreEqual ("System.Void", cce.TargetType.BaseType, "TargetType.BaseType");
+			cce.TargetType = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference target = new CodeTypeReference ("System.Int32");
+			CodeExpression expression = new CodeExpression ();
+			CodeCastExpression cce = new CodeCastExpression (target, expression);
+			Assert.AreSame (expression, cce.Expression, "Expression");
+			cce.Expression = new CodeExpression ();
+			Assert.AreEqual ("System.Int32", cce.TargetType.BaseType, "TargetType.BaseType");
+			cce.TargetType = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCastExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 111 - 0
mcs/class/System/Test/System.CodeDom/CodeCatchClauseCas.cs

@@ -0,0 +1,111 @@
+//
+// CodeCatchClauseCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCatchClauseCas
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCatchClauseCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCatchClause ccc = new CodeCatchClause ();
+			Assert.AreEqual ("System.Exception", ccc.CatchExceptionType.BaseType, "CatchExceptionType.BaseType");
+			ccc.CatchExceptionType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual (String.Empty, ccc.LocalName, "LocalName");
+			ccc.LocalName = null;
+			Assert.AreEqual (0, ccc.Statements.Count, "Statements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeCatchClause ccc = new CodeCatchClause ("mono");
+			Assert.AreEqual ("System.Exception", ccc.CatchExceptionType.BaseType, "CatchExceptionType.BaseType");
+			ccc.CatchExceptionType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual ("mono", ccc.LocalName, "LocalName");
+			ccc.LocalName = String.Empty;
+			Assert.AreEqual (0, ccc.Statements.Count, "Statements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Void");
+			CodeCatchClause ccc = new CodeCatchClause ("mono", ctr);
+			Assert.AreEqual ("System.Void", ccc.CatchExceptionType.BaseType, "CatchExceptionType.BaseType");
+			ccc.CatchExceptionType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual ("mono", ccc.LocalName, "LocalName");
+			ccc.LocalName = String.Empty;
+			Assert.AreEqual (0, ccc.Statements.Count, "Statements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Void");
+			CodeStatement[] statements = new CodeStatement[1] { new CodeStatement () };
+			CodeCatchClause ccc = new CodeCatchClause ("mono", ctr, statements);
+			Assert.AreEqual ("System.Void", ccc.CatchExceptionType.BaseType, "CatchExceptionType.BaseType");
+			ccc.CatchExceptionType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual ("mono", ccc.LocalName, "LocalName");
+			ccc.LocalName = String.Empty;
+			Assert.AreEqual (1, ccc.Statements.Count, "Statements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCatchClause).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeCatchClauseCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeCatchClauseCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCatchClauseCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCatchClauseCollectionCas {
+
+		private CodeCatchClause ccc;
+		private CodeCatchClause[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ccc = new CodeCatchClause ();
+			array = new CodeCatchClause[1] { ccc };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCatchClauseCollection coll = new CodeCatchClauseCollection ();
+			Assert.AreEqual (0, coll.Add (ccc), "Add");
+			Assert.AreSame (ccc, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccc), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccc), "IndexOf");
+			coll.Insert (0, ccc);
+			coll.Remove (ccc);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeCatchClauseCollection coll = new CodeCatchClauseCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ccc), "Add");
+			Assert.AreSame (ccc, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccc), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccc), "IndexOf");
+			coll.Insert (0, ccc);
+			coll.Remove (ccc);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeCatchClauseCollection c = new CodeCatchClauseCollection ();
+			CodeCatchClauseCollection coll = new CodeCatchClauseCollection (c);
+			Assert.AreEqual (0, coll.Add (ccc), "Add");
+			Assert.AreSame (ccc, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccc), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccc), "IndexOf");
+			coll.Insert (0, ccc);
+			coll.Remove (ccc);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCatchClauseCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 89 - 0
mcs/class/System/Test/System.CodeDom/CodeChecksumPragmaCas.cs

@@ -0,0 +1,89 @@
+//
+// CodeChecksumPragmaCas.cs
+//	- CAS unit tests for System.CodeDom.CodeChecksumPragma
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeChecksumPragmaCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeChecksumPragma ccp = new CodeChecksumPragma ();
+			Assert.AreEqual (Guid.Empty, ccp.ChecksumAlgorithmId, "ChecksumAlgorithmId");
+			ccp.ChecksumAlgorithmId = Guid.NewGuid ();
+			Assert.IsNull (ccp.ChecksumData, "ChecksumData");
+			ccp.ChecksumData = new byte [1];
+			Assert.AreEqual (String.Empty, ccp.FileName, "FileName");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			Guid g = Guid.NewGuid ();
+			CodeChecksumPragma ccp = new CodeChecksumPragma ("mono", g, new byte [1]);
+			Assert.AreEqual (g, ccp.ChecksumAlgorithmId, "ChecksumAlgorithmId");
+			ccp.ChecksumAlgorithmId = Guid.Empty;
+			Assert.AreEqual (1, ccp.ChecksumData.Length, "ChecksumData");
+			ccp.ChecksumData = new byte[0];
+			Assert.AreEqual ("mono", ccp.FileName, "FileName");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeChecksumPragma).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 96 - 0
mcs/class/System/Test/System.CodeDom/CodeCommentStatementCas.cs

@@ -0,0 +1,96 @@
+//
+// CodeCommentStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCommentStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCommentStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCommentStatement ccs = new CodeCommentStatement ();
+			Assert.IsNull (ccs.Comment, "Comment");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeComment cc = new CodeComment ("mono");
+			CodeCommentStatement ccs = new CodeCommentStatement (cc);
+			Assert.AreEqual ("mono", ccs.Comment.Text, "Comment.Text");
+			Assert.IsFalse (ccs.Comment.DocComment, "Comment.DocComment");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeCommentStatement ccs = new CodeCommentStatement ("mono");
+			Assert.AreEqual ("mono", ccs.Comment.Text, "Comment.Text");
+			Assert.IsFalse (ccs.Comment.DocComment, "Comment.DocComment");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeCommentStatement ccs = new CodeCommentStatement ("mono", true);
+			Assert.AreEqual ("mono", ccs.Comment.Text, "Comment.Text");
+			Assert.IsTrue (ccs.Comment.DocComment, "Comment.DocComment");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCommentStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeCommentStatementCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeCommentStatementCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCommentStatementCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCommentStatementCollectionCas {
+
+		private CodeCommentStatement ccs;
+		private CodeCommentStatement[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ccs = new CodeCommentStatement ();
+			array = new CodeCommentStatement[1] { ccs };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCommentStatementCollection coll = new CodeCommentStatementCollection ();
+			Assert.AreEqual (0, coll.Add (ccs), "Add");
+			Assert.AreSame (ccs, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf");
+			coll.Insert (0, ccs);
+			coll.Remove (ccs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeCommentStatementCollection coll = new CodeCommentStatementCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ccs), "Add");
+			Assert.AreSame (ccs, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf");
+			coll.Insert (0, ccs);
+			coll.Remove (ccs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeCommentStatementCollection c = new CodeCommentStatementCollection ();
+			CodeCommentStatementCollection coll = new CodeCommentStatementCollection (c);
+			Assert.AreEqual (0, coll.Add (ccs), "Add");
+			Assert.AreSame (ccs, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ccs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf");
+			coll.Insert (0, ccs);
+			coll.Remove (ccs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCommentStatementCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 74 - 0
mcs/class/System/Test/System.CodeDom/CodeCompileUnitCas.cs

@@ -0,0 +1,74 @@
+//
+// CodeCompileUnitCas.cs
+//	- CAS unit tests for System.CodeDom.CodeCompileUnit
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeCompileUnitCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeCompileUnit ccu = new CodeCompileUnit ();
+			Assert.AreEqual (0, ccu.AssemblyCustomAttributes.Count, "AssemblyCustomAttributes");
+			Assert.AreEqual (0, ccu.Namespaces.Count, "Namespaces");
+			Assert.AreEqual (0, ccu.ReferencedAssemblies.Count, "ReferencedAssemblies");
+#if NET_2_0
+			Assert.AreEqual (0, ccu.StartDirectives.Count, "StartDirectives");
+			Assert.AreEqual (0, ccu.EndDirectives.Count, "EndDirectives");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCompileUnit).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 98 - 0
mcs/class/System/Test/System.CodeDom/CodeConditionStatementCas.cs

@@ -0,0 +1,98 @@
+//
+// CodeConditionStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeConditionStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeConditionStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeConditionStatement css = new CodeConditionStatement ();
+			Assert.IsNull (css.Condition, "Condition");
+			css.Condition = new CodeExpression ();
+			Assert.AreEqual (0, css.FalseStatements.Count, "FalseStatements");
+			Assert.AreEqual (0, css.TrueStatements.Count, "TrueStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression condition = new CodeExpression ();
+			CodeStatement[] cs = new CodeStatement[1] { new CodeStatement () };
+			CodeConditionStatement css = new CodeConditionStatement (condition, cs);
+			Assert.AreSame (condition, css.Condition, "Condition");
+			css.Condition = new CodeExpression ();
+			Assert.AreEqual (0, css.FalseStatements.Count, "FalseStatements");
+			Assert.AreEqual (1, css.TrueStatements.Count, "TrueStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression condition = new CodeExpression ();
+			CodeStatement[] cst = new CodeStatement[1] { new CodeStatement () };
+			CodeStatement[] csf = new CodeStatement[2] { new CodeStatement (), new CodeStatement () };
+			CodeConditionStatement css = new CodeConditionStatement (condition, cst, csf);
+			Assert.AreSame (condition, css.Condition, "Condition");
+			css.Condition = new CodeExpression ();
+			Assert.AreEqual (2, css.FalseStatements.Count, "FalseStatements");
+			Assert.AreEqual (1, css.TrueStatements.Count, "TrueStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeConditionStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 69 - 0
mcs/class/System/Test/System.CodeDom/CodeConstructorCas.cs

@@ -0,0 +1,69 @@
+//
+// CodeConstructorCas.cs
+//	- CAS unit tests for System.CodeDom.CodeConstructor
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeConstructorCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeConstructor cc = new CodeConstructor ();
+			Assert.AreEqual (0, cc.BaseConstructorArgs.Count, "BaseConstructorArgs");
+			Assert.AreEqual (0, cc.ChainedConstructorArgs.Count, "ChainedConstructorArgs");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeConstructor).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeDefaultValueExpressionCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeDefaultValueExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDefaultValueExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDefaultValueExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeDefaultValueExpression cdve = new CodeDefaultValueExpression ();
+			Assert.AreEqual ("System.Void", cdve.Type.BaseType, "Type");
+			cdve.Type = new CodeTypeReference ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ();
+			CodeDefaultValueExpression cdve = new CodeDefaultValueExpression (ctr);
+			Assert.AreSame (ctr, cdve.Type, "Type");
+			cdve.Type = new CodeTypeReference ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDefaultValueExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 89 - 0
mcs/class/System/Test/System.CodeDom/CodeDelegateCreateExpressionCas.cs

@@ -0,0 +1,89 @@
+//
+// CodeDelegateCreateExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDelegateCreateExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDelegateCreateExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeDelegateCreateExpression cdce = new CodeDelegateCreateExpression ();
+			Assert.AreEqual ("System.Void", cdce.DelegateType.BaseType, "DelegateType");
+			cdce.DelegateType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual (String.Empty, cdce.MethodName, "MethodName");
+			cdce.MethodName = "mono";
+			Assert.IsNull (cdce.TargetObject, "TargetObject");
+			cdce.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference delegate_type = new CodeTypeReference ("System.Int32");
+			CodeExpression target = new CodeExpression ();
+			string method = "mono";
+			CodeDelegateCreateExpression cdce = new CodeDelegateCreateExpression (delegate_type, target, method);
+			Assert.AreSame (delegate_type, cdce.DelegateType, "DelegateType");
+			cdce.DelegateType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual (method, cdce.MethodName, "MethodName");
+			cdce.MethodName = String.Empty;
+			Assert.AreSame (target, cdce.TargetObject, "TargetObject");
+			cdce.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDelegateCreateExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 93 - 0
mcs/class/System/Test/System.CodeDom/CodeDelegateInvokeExpressionCas.cs

@@ -0,0 +1,93 @@
+//
+// CodeDelegateInvokeExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDelegateInvokeExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDelegateInvokeExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeDelegateInvokeExpression cdie = new CodeDelegateInvokeExpression ();
+			Assert.AreEqual (0, cdie.Parameters.Count, "Parameters");
+			Assert.IsNull (cdie.TargetObject, "TargetObject");
+			cdie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeDelegateInvokeExpression cdie = new CodeDelegateInvokeExpression (target);
+			Assert.AreEqual (0, cdie.Parameters.Count, "Parameters");
+			Assert.AreSame (target, cdie.TargetObject, "TargetObject");
+			cdie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeExpression[] parameters = new CodeExpression[1] { target };
+			CodeDelegateInvokeExpression cdie = new CodeDelegateInvokeExpression (target, parameters);
+			Assert.AreEqual (1, cdie.Parameters.Count, "Parameters");
+			Assert.AreSame (target, cdie.TargetObject, "TargetObject");
+			cdie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDelegateInvokeExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeDirectionExpressionCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeDirectionExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDirectionExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDirectionExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeDirectionExpression cde = new CodeDirectionExpression ();
+			Assert.AreEqual (FieldDirection.In, cde.Direction, "Direction");
+			cde.Direction = FieldDirection.Out;
+			Assert.IsNull (cde.Expression, "Expression");
+			cde.Expression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression expression = new CodeExpression ();
+			CodeDirectionExpression cde = new CodeDirectionExpression (FieldDirection.Out, expression);
+			Assert.AreEqual (FieldDirection.Out, cde.Direction, "Direction");
+			cde.Direction = FieldDirection.Ref;
+			Assert.AreSame (expression, cde.Expression, "Expression");
+			cde.Expression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDirectionExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 71 - 0
mcs/class/System/Test/System.CodeDom/CodeDirectiveCas.cs

@@ -0,0 +1,71 @@
+//
+// CodeDirectiveCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDirective
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDirectiveCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			 new CodeDirective ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDirective).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 123 - 0
mcs/class/System/Test/System.CodeDom/CodeDirectiveCollectionCas.cs

@@ -0,0 +1,123 @@
+//
+// CodeDirectiveCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeDirectiveCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeDirectiveCollectionCas {
+
+		private CodeDirective cd;
+		private CodeDirective[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cd = new CodeDirective ();
+			array = new CodeDirective[1] { cd };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeDirectiveCollection coll = new CodeDirectiveCollection ();
+			Assert.AreEqual (0, coll.Add (cd), "Add");
+			Assert.AreSame (cd, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cd), "IndexOf");
+			coll.Insert (0, cd);
+			coll.Remove (cd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeDirectiveCollection coll = new CodeDirectiveCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (cd), "Add");
+			Assert.AreSame (cd, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cd), "IndexOf");
+			coll.Insert (0, cd);
+			coll.Remove (cd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeDirectiveCollection c = new CodeDirectiveCollection ();
+			CodeDirectiveCollection coll = new CodeDirectiveCollection (c);
+			Assert.AreEqual (0, coll.Add (cd), "Add");
+			Assert.AreSame (cd, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cd), "IndexOf");
+			coll.Insert (0, cd);
+			coll.Remove (cd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeDirectiveCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodeEntryPointMethodCas.cs

@@ -0,0 +1,67 @@
+//
+// CodeEntryPointMethodCas.cs
+//	- CAS unit tests for System.CodeDom.CodeEntryPointMethod
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeEntryPointMethodCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			 new CodeEntryPointMethod ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeEntryPointMethod).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeEventReferenceExpressionCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeEventReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeEventReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeEventReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeEventReferenceExpression cere = new CodeEventReferenceExpression ();
+			Assert.AreEqual (String.Empty, cere.EventName, "EventName");
+			cere.EventName = "mono";
+			Assert.IsNull (cere.TargetObject, "TargetObject");
+			cere.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeEventReferenceExpression cere = new CodeEventReferenceExpression (target, "mono");
+			Assert.AreEqual ("mono", cere.EventName, "EventName");
+			cere.EventName = String.Empty;
+			Assert.AreSame (target, cere.TargetObject, "TargetObject");
+			cere.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeEventReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodeExpressionCas.cs

@@ -0,0 +1,67 @@
+//
+// CodeExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeExpressionCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeExpressionCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeExpressionCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeExpressionCollectionCas {
+
+		private CodeExpression ce;
+		private CodeExpression[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ce = new CodeExpression ();
+			array = new CodeExpression[1] { ce };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeExpressionCollection coll = new CodeExpressionCollection ();
+			Assert.AreEqual (0, coll.Add (ce), "Add");
+			Assert.AreSame (ce, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ce), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ce), "IndexOf");
+			coll.Insert (0, ce);
+			coll.Remove (ce);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpressionCollection coll = new CodeExpressionCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ce), "Add");
+			Assert.AreSame (ce, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ce), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ce), "IndexOf");
+			coll.Insert (0, ce);
+			coll.Remove (ce);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpressionCollection c = new CodeExpressionCollection ();
+			CodeExpressionCollection coll = new CodeExpressionCollection (c);
+			Assert.AreEqual (0, coll.Add (ce), "Add");
+			Assert.AreSame (ce, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ce), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ce), "IndexOf");
+			coll.Insert (0, ce);
+			coll.Remove (ce);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeExpressionCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 77 - 0
mcs/class/System/Test/System.CodeDom/CodeExpressionStatementCas.cs

@@ -0,0 +1,77 @@
+//
+// CodeExpressionStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeExpressionStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeExpressionStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeExpressionStatement ces = new CodeExpressionStatement ();
+			Assert.IsNull (ces.Expression, "Expression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression expression = new CodeExpression ();
+			CodeExpressionStatement ces = new CodeExpressionStatement (expression);
+			Assert.AreSame (expression, ces.Expression, "Expression");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeExpressionStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeFieldReferenceExpressionCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeFieldReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeFieldReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeFieldReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeFieldReferenceExpression cfre = new CodeFieldReferenceExpression ();
+			Assert.AreEqual (String.Empty, cfre.FieldName, "FieldName");
+			cfre.FieldName = "mono";
+			Assert.IsNull (cfre.TargetObject, "TargetObject");
+			cfre.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeFieldReferenceExpression cfre = new CodeFieldReferenceExpression (target, "mono");
+			Assert.AreEqual ("mono", cfre.FieldName, "FieldName");
+			cfre.FieldName = String.Empty;
+			Assert.AreSame (target, cfre.TargetObject, "TargetObject");
+			cfre.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeFieldReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 79 - 0
mcs/class/System/Test/System.CodeDom/CodeGotoStatementCas.cs

@@ -0,0 +1,79 @@
+//
+// CodeGotoStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeGotoStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeGotoStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeGotoStatement cgs = new CodeGotoStatement ();
+			Assert.IsNull (cgs.Label, "Label");
+			cgs.Label = "mono";
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeGotoStatement cgs = new CodeGotoStatement ("mono");
+			Assert.AreEqual ("mono", cgs.Label, "Label");
+			cgs.Label = "monkey"; // doesn't accept String.Empty
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			// the default .ctor was added in 2.0
+			ConstructorInfo ci = typeof (CodeGotoStatement).GetConstructor (new Type[1] { typeof (string) });
+			Assert.IsNotNull (ci, ".ctor(string)");
+			Assert.IsNotNull (ci.Invoke (new object[1] { "mono" }), "invoke");
+		}
+	}
+}

+ 82 - 0
mcs/class/System/Test/System.CodeDom/CodeIndexerExpressionCas.cs

@@ -0,0 +1,82 @@
+//
+// CodeIndexerExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeIndexerExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeIndexerExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeIndexerExpression cie = new CodeIndexerExpression ();
+			Assert.AreEqual (0, cie.Indices.Count, "Indices");
+			Assert.IsNull (cie.TargetObject, "TargetObject");
+			cie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeExpression[] indices = new CodeExpression[1] { target };
+			CodeIndexerExpression cie = new CodeIndexerExpression (target, indices);
+			Assert.AreEqual (1, cie.Indices.Count, "Indices");
+			Assert.AreSame (target, cie.TargetObject, "TargetObject");
+			cie.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeIndexerExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 92 - 0
mcs/class/System/Test/System.CodeDom/CodeIterationStatementCas.cs

@@ -0,0 +1,92 @@
+//
+// CodeIterationStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeIterationStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeIterationStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeIterationStatement cis = new CodeIterationStatement ();
+			Assert.IsNull (cis.IncrementStatement, "IncrementStatement");
+			cis.IncrementStatement = new CodeStatement ();
+			Assert.IsNull (cis.InitStatement, "InitStatement");
+			cis.InitStatement = new CodeStatement ();
+			Assert.AreEqual (0, cis.Statements.Count, "Statements");
+			Assert.IsNull (cis.TestExpression, "TestExpression");
+			cis.TestExpression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeStatement init = new CodeStatement ();
+			CodeExpression test = new CodeExpression ();
+			CodeStatement increment = new CodeStatement ();
+			CodeStatement[] statements = new CodeStatement[2] { init, increment };
+			CodeIterationStatement cis = new CodeIterationStatement (init, test, increment, statements);
+			Assert.AreSame (increment, cis.IncrementStatement, "IncrementStatement");
+			cis.IncrementStatement = new CodeStatement ();
+			Assert.AreSame (init, cis.InitStatement, "InitStatement");
+			cis.InitStatement = new CodeStatement ();
+			Assert.AreEqual (2, cis.Statements.Count, "Statements");
+			Assert.AreSame (test, cis.TestExpression, "TestExpression");
+			cis.TestExpression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeIterationStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeLinePragmaCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeLinePragmaCas.cs
+//	- CAS unit tests for System.CodeDom.CodeLinePragma
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeLinePragmaCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeLinePragma clp = new CodeLinePragma ();
+			Assert.AreEqual (String.Empty, clp.FileName, "FileName");
+			clp.FileName = "filename";
+			Assert.AreEqual (0, clp.LineNumber, "LineNumber");
+			clp.LineNumber = Int32.MinValue;
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeLinePragma clp = new CodeLinePragma ("filename", Int32.MaxValue);
+			Assert.AreEqual ("filename", clp.FileName, "FileName");
+			clp.FileName = String.Empty;
+			Assert.AreEqual (Int32.MaxValue, clp.LineNumber, "LineNumber");
+			clp.LineNumber = 0;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			// the default .ctor was added in 2.0
+			ConstructorInfo ci = typeof (CodeLinePragma).GetConstructor (new Type[2] { typeof (string), typeof (int) });
+			Assert.IsNotNull (ci, ".ctor(string,int)");
+			Assert.IsNotNull (ci.Invoke (new object[2] { "mono", -1 }), "invoke");
+		}
+	}
+}

+ 72 - 0
mcs/class/System/Test/System.CodeDom/CodeMemberEventCas.cs

@@ -0,0 +1,72 @@
+//
+// CodeMemberEventCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMemberEvent
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMemberEventCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMemberEvent cme = new CodeMemberEvent ();
+			Assert.AreEqual (0, cme.ImplementationTypes.Count, "ImplementationTypes");
+			Assert.IsNull (cme.PrivateImplementationType, "PrivateImplementationType");
+			cme.PrivateImplementationType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual ("System.Void", cme.Type.BaseType, "Type");
+			cme.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMemberEvent).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 105 - 0
mcs/class/System/Test/System.CodeDom/CodeMemberFieldCas.cs

@@ -0,0 +1,105 @@
+//
+// CodeMemberFieldCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMemberField
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMemberFieldCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMemberField cmf = new CodeMemberField ();
+			Assert.IsNull (cmf.InitExpression, "InitExpression");
+			cmf.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("System.Void", cmf.Type.BaseType, "Type");
+			cmf.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Int32");
+			CodeMemberField cmf = new CodeMemberField (type, "mono");
+			Assert.IsNull (cmf.InitExpression, "InitExpression");
+			cmf.InitExpression = new CodeExpression ();
+			Assert.AreSame (type, cmf.Type, "Type");
+			cmf.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeMemberField cmf = new CodeMemberField ("System.Int32", "mono");
+			Assert.IsNull (cmf.InitExpression, "InitExpression");
+			cmf.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("System.Int32", cmf.Type.BaseType, "Type");
+			cmf.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeMemberField cmf = new CodeMemberField (typeof (int), "mono");
+			Assert.IsNull (cmf.InitExpression, "InitExpression");
+			cmf.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("System.Int32", cmf.Type.BaseType, "Type");
+			cmf.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMemberField).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeMemberMethodCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeMemberMethodCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMemberMethod
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMemberMethodCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMemberMethod cmm = new CodeMemberMethod ();
+			Assert.AreEqual (0, cmm.ImplementationTypes.Count, "ImplementationTypes");
+			Assert.AreEqual (0, cmm.Parameters.Count, "Parameters");
+			Assert.IsNull (cmm.PrivateImplementationType, "PrivateImplementationType");
+			cmm.PrivateImplementationType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual ("System.Void", cmm.ReturnType.BaseType, "ReturnType");
+			cmm.ReturnType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual (0, cmm.Statements.Count, "Statements");
+			Assert.AreEqual (0, cmm.ReturnTypeCustomAttributes.Count, "ReturnTypeCustomAttributes");
+#if NET_2_0
+			Assert.AreEqual (0, cmm.TypeParameters.Count, "TypeParameters");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMemberMethod).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 79 - 0
mcs/class/System/Test/System.CodeDom/CodeMemberPropertyCas.cs

@@ -0,0 +1,79 @@
+//
+// CodeMemberPropertyCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMemberProperty
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMemberPropertyCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMemberProperty cmp = new CodeMemberProperty ();
+			Assert.AreEqual (0, cmp.GetStatements.Count, "GetStatements");
+			Assert.IsFalse (cmp.HasGet, "HasGet");
+			cmp.HasGet = true;
+			Assert.IsFalse (cmp.HasSet, "HasSet");
+			cmp.HasSet = true;
+			Assert.AreEqual (0, cmp.ImplementationTypes.Count, "ImplementationTypes");
+			Assert.AreEqual (0, cmp.Parameters.Count, "Parameters");
+			Assert.IsNull (cmp.PrivateImplementationType, "PrivateImplementationType");
+			cmp.PrivateImplementationType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual (0, cmp.SetStatements.Count, "SetStatements");
+			Assert.AreEqual ("System.Void", cmp.Type.BaseType, "ReturnType");
+			cmp.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMemberProperty).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 96 - 0
mcs/class/System/Test/System.CodeDom/CodeMethodInvokeExpressionCas.cs

@@ -0,0 +1,96 @@
+//
+// CodeMethodInvokeExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMethodInvokeExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMethodInvokeExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression ();
+			Assert.IsNull (cmie.Method.TargetObject, "Method.TargetObject");
+			Assert.AreEqual (String.Empty, cmie.Method.MethodName, "Method.MethodName");
+			cmie.Method = new CodeMethodReferenceExpression ();
+			Assert.AreEqual (0, cmie.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeMethodReferenceExpression method = new CodeMethodReferenceExpression ();
+			CodeExpression[] parameters = new CodeExpression[1] { new CodeExpression () };
+			CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression (method, parameters);
+			Assert.AreSame (method, cmie.Method, "Method");
+			cmie.Method = new CodeMethodReferenceExpression ();
+			Assert.AreEqual (1, cmie.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeExpression[] parameters = new CodeExpression[1] { target };
+			CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression (target, "mono", parameters);
+			Assert.AreSame (target, cmie.Method.TargetObject, "Method.TargetObject");
+			Assert.AreEqual ("mono", cmie.Method.MethodName, "Method.MethodName");
+			cmie.Method = new CodeMethodReferenceExpression ();
+			Assert.AreEqual (1, cmie.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMethodInvokeExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 103 - 0
mcs/class/System/Test/System.CodeDom/CodeMethodReferenceExpressionCas.cs

@@ -0,0 +1,103 @@
+//
+// CodeMethodReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMethodReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMethodReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression ();
+			Assert.AreEqual (String.Empty, cmre.MethodName, "MethodName");
+			cmre.MethodName = "mono";
+			Assert.IsNull (cmre.TargetObject, "TargetObject");
+			cmre.TargetObject = new CodeExpression ();
+#if NET_2_0
+			Assert.AreEqual (0, cmre.TypeArguments.Count, "TypeArguments");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression (target, "mono");
+			Assert.AreEqual ("mono", cmre.MethodName, "MethodName");
+			cmre.MethodName = String.Empty;
+			Assert.AreSame (target, cmre.TargetObject, "TargetObject");
+			cmre.TargetObject = new CodeExpression ();
+#if NET_2_0
+			Assert.AreEqual (0, cmre.TypeArguments.Count, "TypeArguments");
+#endif
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeTypeReference[] parameters = new CodeTypeReference[1] { new CodeTypeReference () };
+			CodeMethodReferenceExpression cmre = new CodeMethodReferenceExpression (target, "mono", parameters);
+			Assert.AreEqual ("mono", cmre.MethodName, "MethodName");
+			cmre.MethodName = String.Empty;
+			Assert.AreSame (target, cmre.TargetObject, "TargetObject");
+			cmre.TargetObject = new CodeExpression ();
+			Assert.AreEqual (1, cmre.TypeArguments.Count, "TypeArguments");
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMethodReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 79 - 0
mcs/class/System/Test/System.CodeDom/CodeMethodReturnStatementCas.cs

@@ -0,0 +1,79 @@
+//
+// CodeMethodReturnStatementCas.cs
+//	- CAS unit tests for System.CodeDom.CodeMethodReturnStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeMethodReturnStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeMethodReturnStatement cmrs = new CodeMethodReturnStatement ();
+			Assert.IsNull (cmrs.Expression, "Expression");
+			cmrs.Expression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression expression = new CodeExpression ();
+			CodeMethodReturnStatement cmrs = new CodeMethodReturnStatement (expression);
+			Assert.AreSame (expression, cmrs.Expression, "Expression");
+			cmrs.Expression = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeMethodReturnStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 100 - 0
mcs/class/System/Test/System.CodeDom/CodeNamespaceCas.cs

@@ -0,0 +1,100 @@
+//
+// CodeNamespaceCas.cs
+//	- CAS unit tests for System.CodeDom.CodeNamespace
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeNamespaceCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		private void Handler (object sender, EventArgs e)
+		{
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeNamespace cn = new CodeNamespace ();
+			Assert.AreEqual (0, cn.Comments.Count, "Comments");
+			Assert.AreEqual (0, cn.Imports.Count, "Imports");
+			Assert.AreEqual (String.Empty, cn.Name, "Name");
+			cn.Name = "mono";
+			Assert.AreEqual (0, cn.Types.Count, "Types");
+			cn.PopulateComments += new EventHandler (Handler);
+			cn.PopulateComments -= new EventHandler (Handler);
+			cn.PopulateImports += new EventHandler (Handler);
+			cn.PopulateImports -= new EventHandler (Handler);
+			cn.PopulateTypes += new EventHandler (Handler);
+			cn.PopulateTypes -= new EventHandler (Handler);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeNamespace cn = new CodeNamespace ("mono");
+			Assert.AreEqual (0, cn.Comments.Count, "Comments");
+			Assert.AreEqual (0, cn.Imports.Count, "Imports");
+			Assert.AreEqual ("mono", cn.Name, "Name");
+			cn.Name = String.Empty;
+			Assert.AreEqual (0, cn.Types.Count, "Types");
+			cn.PopulateComments += new EventHandler (Handler);
+			cn.PopulateComments -= new EventHandler (Handler);
+			cn.PopulateImports += new EventHandler (Handler);
+			cn.PopulateImports -= new EventHandler (Handler);
+			cn.PopulateTypes += new EventHandler (Handler);
+			cn.PopulateTypes -= new EventHandler (Handler);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeNamespace).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeNamespaceCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeNamespaceCollectionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeNamespaceCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeNamespaceCollectionCas {
+
+		private CodeNamespace cn;
+		private CodeNamespace[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cn = new CodeNamespace ();
+			array = new CodeNamespace[1] { cn };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeNamespaceCollection coll = new CodeNamespaceCollection ();
+			Assert.AreEqual (0, coll.Add (cn), "Add");
+			Assert.AreSame (cn, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cn), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cn), "IndexOf");
+			coll.Insert (0, cn);
+			coll.Remove (cn);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeNamespaceCollection coll = new CodeNamespaceCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (cn), "Add");
+			Assert.AreSame (cn, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cn), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cn), "IndexOf");
+			coll.Insert (0, cn);
+			coll.Remove (cn);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeNamespaceCollection c = new CodeNamespaceCollection ();
+			CodeNamespaceCollection coll = new CodeNamespaceCollection (c);
+			Assert.AreEqual (0, coll.Add (cn), "Add");
+			Assert.AreSame (cn, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cn), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cn), "IndexOf");
+			coll.Insert (0, cn);
+			coll.Remove (cn);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeNamespaceCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 86 - 0
mcs/class/System/Test/System.CodeDom/CodeNamespaceImportCas.cs

@@ -0,0 +1,86 @@
+//
+// CodeNamespaceImportCas.cs
+//	- CAS unit tests for System.CodeDom.CodeNamespaceImport
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeNamespaceImportCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		private void Handler (object sender, EventArgs e)
+		{
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeNamespaceImport cni = new CodeNamespaceImport ();
+			Assert.IsNull (cni.LinePragma, "LinePragma");
+			cni.LinePragma = new CodeLinePragma (String.Empty, Int32.MinValue);
+			Assert.AreEqual (String.Empty, cni.Namespace, "Namespace");
+			cni.Namespace = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeNamespaceImport cni = new CodeNamespaceImport ("mono");
+			Assert.IsNull (cni.LinePragma, "LinePragma");
+			cni.LinePragma = new CodeLinePragma (String.Empty, Int32.MinValue);
+			Assert.AreEqual ("mono", cni.Namespace, "Namespace");
+			cni.Namespace = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeNamespaceImport).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 111 - 0
mcs/class/System/Test/System.CodeDom/CodeNamespaceImportCollectionCas.cs

@@ -0,0 +1,111 @@
+//
+// CodeNamespaceImportCollectionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeNamespaceImportCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Collections;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeNamespaceImportCollectionCas {
+
+		private CodeNamespaceImport cni;
+		private CodeNamespaceImport[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cni = new CodeNamespaceImport ();
+			array = new CodeNamespaceImport[1] { cni };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeNamespaceImportCollection coll = new CodeNamespaceImportCollection ();
+			coll.Add (cni);
+			Assert.AreSame (cni, coll[0], "this[int]");
+			coll[0] = cni;
+			coll.Clear ();
+			coll.AddRange (array);
+			Assert.IsNotNull (coll.GetEnumerator (), "GetEnumerator");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void IList_Deny_Unrestricted ()
+		{
+			IList coll = (IList) new CodeNamespaceImportCollection ();
+			Assert.IsFalse (coll.IsFixedSize, "IsFixedSize");
+			Assert.IsFalse (coll.IsReadOnly, "IsReadOnly");
+			Assert.AreEqual (0, coll.Add (cni), "Add");
+			Assert.AreSame (cni, coll[0], "this[int]");
+			coll[0] = cni;
+			Assert.IsTrue (coll.Contains (cni), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cni), "IndexOf");
+			coll.Insert (0, cni);
+			coll.Remove (cni);
+			coll.RemoveAt (0);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void ICollection_Deny_Unrestricted ()
+		{
+			ICollection coll = (ICollection) new CodeNamespaceImportCollection ();
+			Assert.IsNull (coll.SyncRoot, "SyncRoot");
+			Assert.IsFalse (coll.IsSynchronized, "IsSynchronized");
+			coll.CopyTo (array, 0);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeReferenceCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 68 - 0
mcs/class/System/Test/System.CodeDom/CodeObjectCas.cs

@@ -0,0 +1,68 @@
+//
+// CodeObjectCas.cs
+//	- CAS unit tests for System.CodeDom.CodeObject
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeObjectCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeObject co = new CodeObject ();
+			Assert.IsNotNull (co.UserData, "UserData");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeObject).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 104 - 0
mcs/class/System/Test/System.CodeDom/CodeObjectCreateExpressionCas.cs

@@ -0,0 +1,104 @@
+//
+// CodeObjectCreateExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeObjectCreateExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeObjectCreateExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeObjectCreateExpression coce = new CodeObjectCreateExpression ();
+			Assert.AreEqual ("System.Void", coce.CreateType.BaseType, "CreateType.BaseType");
+			coce.CreateType = new CodeTypeReference ("System.Int32");
+			Assert.AreEqual (0, coce.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference create = new CodeTypeReference ("System.Int32");
+			CodeExpression[] parameters = new CodeExpression[1] { new CodeExpression () };
+			CodeObjectCreateExpression coce = new CodeObjectCreateExpression (create, parameters);
+			Assert.AreSame (create, coce.CreateType, "CreateType");
+			coce.CreateType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual (1, coce.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression[] parameters = new CodeExpression[1] { new CodeExpression () };
+			CodeObjectCreateExpression coce = new CodeObjectCreateExpression ("System.Int32", parameters);
+			Assert.AreEqual ("System.Int32", coce.CreateType.BaseType, "CreateType.BaseType");
+			coce.CreateType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual (1, coce.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeExpression[] parameters = new CodeExpression[1] { new CodeExpression () };
+			CodeObjectCreateExpression coce = new CodeObjectCreateExpression (typeof (int), parameters);
+			Assert.AreEqual ("System.Int32", coce.CreateType.BaseType, "CreateType.BaseType");
+			coce.CreateType = new CodeTypeReference ("System.Void");
+			Assert.AreEqual (1, coce.Parameters.Count, "Parameters");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeObjectCreateExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 121 - 0
mcs/class/System/Test/System.CodeDom/CodeParameterDeclarationExpressionCas.cs

@@ -0,0 +1,121 @@
+//
+// CodeParameterDeclarationExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodeParameterDeclarationExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeParameterDeclarationExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression ();
+			Assert.AreEqual (0, cpde.CustomAttributes.Count, "CustomAttributes");
+			cpde.CustomAttributes = new CodeAttributeDeclarationCollection ();
+			Assert.AreEqual (FieldDirection.In, cpde.Direction, "Direction");
+			cpde.Direction = FieldDirection.Out;
+			Assert.AreEqual (String.Empty, cpde.Name, "Name");
+			cpde.Name = "mono";
+			Assert.AreEqual ("System.Void", cpde.Type.BaseType, "Type");
+			cpde.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Void");
+			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression (type, "mono");
+			Assert.AreEqual (0, cpde.CustomAttributes.Count, "CustomAttributes");
+			cpde.CustomAttributes = new CodeAttributeDeclarationCollection ();
+			Assert.AreEqual (FieldDirection.In, cpde.Direction, "Direction");
+			cpde.Direction = FieldDirection.Out;
+			Assert.AreEqual ("mono", cpde.Name, "Name");
+			cpde.Name = String.Empty;
+			Assert.AreSame (type, cpde.Type, "Type");
+			cpde.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression ("System.Int32", "mono");
+			Assert.AreEqual (0, cpde.CustomAttributes.Count, "CustomAttributes");
+			cpde.CustomAttributes = new CodeAttributeDeclarationCollection ();
+			Assert.AreEqual (FieldDirection.In, cpde.Direction, "Direction");
+			cpde.Direction = FieldDirection.Out;
+			Assert.AreEqual ("mono", cpde.Name, "Name");
+			cpde.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cpde.Type.BaseType, "Type");
+			cpde.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpression cpde = new CodeParameterDeclarationExpression (typeof (int), "mono");
+			Assert.AreEqual (0, cpde.CustomAttributes.Count, "CustomAttributes");
+			cpde.CustomAttributes = new CodeAttributeDeclarationCollection ();
+			Assert.AreEqual (FieldDirection.In, cpde.Direction, "Direction");
+			cpde.Direction = FieldDirection.Out;
+			Assert.AreEqual ("mono", cpde.Name, "Name");
+			cpde.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cpde.Type.BaseType, "Type");
+			cpde.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeParameterDeclarationExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeParameterDeclarationExpressionCollectionCas.cs - CAS unit tests for
+//	System.CodeDom.CodeParameterDeclarationExpressionCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeParameterDeclarationExpressionCollectionCas {
+
+		private CodeParameterDeclarationExpression cpde;
+		private CodeParameterDeclarationExpression[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cpde = new CodeParameterDeclarationExpression ();
+			array = new CodeParameterDeclarationExpression[1] { cpde };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection ();
+			Assert.AreEqual (0, coll.Add (cpde), "Add");
+			Assert.AreSame (cpde, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cpde), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cpde), "IndexOf");
+			coll.Insert (0, cpde);
+			coll.Remove (cpde);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (cpde), "Add");
+			Assert.AreSame (cpde, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cpde), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cpde), "IndexOf");
+			coll.Insert (0, cpde);
+			coll.Remove (cpde);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeParameterDeclarationExpressionCollection c = new CodeParameterDeclarationExpressionCollection ();
+			CodeParameterDeclarationExpressionCollection coll = new CodeParameterDeclarationExpressionCollection (c);
+			Assert.AreEqual (0, coll.Add (cpde), "Add");
+			Assert.AreSame (cpde, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cpde), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cpde), "IndexOf");
+			coll.Insert (0, cpde);
+			coll.Remove (cpde);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeCommentStatementCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 79 - 0
mcs/class/System/Test/System.CodeDom/CodePrimitiveExpressionCas.cs

@@ -0,0 +1,79 @@
+//
+// CodePrimitiveExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodePrimitiveExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodePrimitiveExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodePrimitiveExpression cpe = new CodePrimitiveExpression ();
+			Assert.IsNull (cpe.Value, "Value");
+			cpe.Value = new object ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			object o = new object ();
+			CodePrimitiveExpression cpe = new CodePrimitiveExpression (o);
+			Assert.AreSame (o, cpe.Value, "Value");
+			cpe.Value = new object ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodePrimitiveExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodePropertyReferenceExpressionCas.cs

@@ -0,0 +1,83 @@
+//
+// CodePropertyReferenceExpressionCas.cs
+//	- CAS unit tests for System.CodeDom.CodePropertyReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodePropertyReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodePropertyReferenceExpression cpre = new CodePropertyReferenceExpression ();
+			Assert.AreEqual (String.Empty, cpre.PropertyName, "PropertyName");
+			cpre.PropertyName = "mono";
+			Assert.IsNull (cpre.TargetObject, "TargetObject");
+			cpre.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodePropertyReferenceExpression cpre = new CodePropertyReferenceExpression (target, "mono");
+			Assert.AreEqual ("mono", cpre.PropertyName, "PropertyName");
+			cpre.PropertyName = String.Empty;
+			Assert.AreSame (target, cpre.TargetObject, "TargetObject");
+			cpre.TargetObject = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodePropertyReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs

@@ -0,0 +1,67 @@
+//
+// CodePropertySetValueReferenceExpressionCas.cs - CAS unit tests for 
+//	System.CodeDom.CodePropertySetValueReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodePropertySetValueReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			new CodePropertySetValueReferenceExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodePropertySetValueReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 86 - 0
mcs/class/System/Test/System.CodeDom/CodeRegionDirectiveCas.cs

@@ -0,0 +1,86 @@
+//
+// CodeRegionDirectiveCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeRegionDirectiveCas
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeRegionDirectiveCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeRegionDirective crd = new CodeRegionDirective ();
+			Assert.AreEqual (CodeRegionMode.None, crd.RegionMode, "RegionMode");
+			crd.RegionMode = CodeRegionMode.Start;
+			Assert.AreEqual (String.Empty, crd.RegionText, "RegionText");
+			crd.RegionText = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeRegionDirective crd = new CodeRegionDirective (CodeRegionMode.Start, "mono");
+			Assert.AreEqual (CodeRegionMode.Start, crd.RegionMode, "RegionMode");
+			crd.RegionMode = CodeRegionMode.End;
+			Assert.AreEqual ("mono", crd.RegionText, "RegionText");
+			crd.RegionText = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeRegionDirective).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 98 - 0
mcs/class/System/Test/System.CodeDom/CodeRemoveEventStatementCas.cs

@@ -0,0 +1,98 @@
+//
+// CodeRemoveEventStatementCas.cs - CAS unit tests for 
+//	System.CodeDom.CodeRemoveEventStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeRemoveEventStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeRemoveEventStatement cres = new CodeRemoveEventStatement ();
+			Assert.AreEqual (String.Empty, cres.Event.EventName, "Event");
+			cres.Event = new CodeEventReferenceExpression ();
+			Assert.IsNull (cres.Listener, "Listener");
+			cres.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeEventReferenceExpression event_ref = new CodeEventReferenceExpression ();
+			CodeExpression listener = new CodeExpression ();
+			CodeRemoveEventStatement cres = new CodeRemoveEventStatement (event_ref, listener);
+			Assert.AreSame (event_ref, cres.Event, "Event");
+			cres.Event = new CodeEventReferenceExpression ();
+			Assert.AreSame (listener, cres.Listener, "Listener");
+			cres.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeExpression target = new CodeExpression ();
+			CodeExpression listener = new CodeExpression ();
+			CodeRemoveEventStatement cres = new CodeRemoveEventStatement (target, "mono", listener);
+			Assert.AreEqual ("mono", cres.Event.EventName, "Event.EventName");
+			Assert.AreSame (target, cres.Event.TargetObject, "Event.TargetObject");
+			cres.Event = new CodeEventReferenceExpression ();
+			Assert.AreSame (listener, cres.Listener, "Listener");
+			cres.Listener = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeRemoveEventStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 83 - 0
mcs/class/System/Test/System.CodeDom/CodeSnippetCompileUnitCas.cs

@@ -0,0 +1,83 @@
+//
+// CodeSnippetCompileUnitCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeSnippetCompileUnit
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeSnippetCompileUnitCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeSnippetCompileUnit cscu = new CodeSnippetCompileUnit ();
+			Assert.IsNull (cscu.LinePragma, "LinePragma");
+			cscu.LinePragma = new CodeLinePragma ();
+			Assert.AreEqual (String.Empty, cscu.Value, "Value");
+			cscu.Value = "mono";
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeSnippetCompileUnit cscu = new CodeSnippetCompileUnit ("mono");
+			Assert.IsNull (cscu.LinePragma, "LinePragma");
+			cscu.LinePragma = new CodeLinePragma (String.Empty, Int32.MaxValue);
+			Assert.AreEqual ("mono", cscu.Value, "Value");
+			cscu.Value = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			// the default .ctor was added in 2.0
+			ConstructorInfo ci = typeof (CodeSnippetCompileUnit).GetConstructor (new Type[1] { typeof (string) });
+			Assert.IsNotNull (ci, ".ctor(string)");
+			Assert.IsNotNull (ci.Invoke (new object[1] { "mono" }), "invoke");
+		}
+	}
+}

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeSnippetExpressionCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeSnippetExpressionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeSnippetExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeSnippetExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeSnippetExpression cse = new CodeSnippetExpression ();
+			Assert.AreEqual (String.Empty, cse.Value, "Value");
+			cse.Value = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeSnippetExpression cse = new CodeSnippetExpression ("mono");
+			Assert.AreEqual ("mono", cse.Value, "Value");
+			cse.Value = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeSnippetExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeSnippetStatementCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeSnippetStatementCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeSnippetStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeSnippetStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeSnippetStatement css = new CodeSnippetStatement ();
+			Assert.AreEqual (String.Empty, css.Value, "Value");
+			css.Value = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeSnippetStatement css = new CodeSnippetStatement ("mono");
+			Assert.AreEqual ("mono", css.Value, "Value");
+			css.Value = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeSnippetStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeSnippetTypeMemberCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeSnippetTypeMemberCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeSnippetTypeMember
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeSnippetTypeMemberCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeSnippetTypeMember cstm = new CodeSnippetTypeMember ();
+			Assert.AreEqual (String.Empty, cstm.Text, "Text");
+			cstm.Text = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeSnippetTypeMember cstm = new CodeSnippetTypeMember ("mono");
+			Assert.AreEqual ("mono", cstm.Text, "Value");
+			cstm.Text = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeSnippetTypeMember).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 73 - 0
mcs/class/System/Test/System.CodeDom/CodeStatementCas.cs

@@ -0,0 +1,73 @@
+//
+// CodeStatementCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeStatement cs = new CodeStatement ();
+			Assert.IsNull (cs.LinePragma, "LinePragma");
+			cs.LinePragma = new CodeLinePragma (String.Empty, Int16.MinValue);
+#if NET_2_0
+			Assert.AreEqual (0, cs.StartDirectives.Count, "StartDirectives");
+			Assert.AreEqual (0, cs.EndDirectives.Count, "EndDirectives");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeStatementCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeStatementCollectionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeStatementCollectionCas
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeStatementCollectionCas {
+
+		private CodeStatement cs;
+		private CodeStatement[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			cs = new CodeStatement ();
+			array = new CodeStatement[1] { cs };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeStatementCollection coll = new CodeStatementCollection ();
+			Assert.AreEqual (0, coll.Add (cs), "Add");
+			Assert.AreSame (cs, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cs), "IndexOf");
+			coll.Insert (0, cs);
+			coll.Remove (cs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeStatementCollection coll = new CodeStatementCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (cs), "Add");
+			Assert.AreSame (cs, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cs), "IndexOf");
+			coll.Insert (0, cs);
+			coll.Remove (cs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeStatementCollection c = new CodeStatementCollection ();
+			CodeStatementCollection coll = new CodeStatementCollection (c);
+			Assert.AreEqual (0, coll.Add (cs), "Add");
+			Assert.AreSame (cs, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (cs), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (cs), "IndexOf");
+			coll.Insert (0, cs);
+			coll.Remove (cs);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeStatementCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodeThisReferenceExpressionCas.cs

@@ -0,0 +1,67 @@
+//
+// CodeThisReferenceExpressionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeThisReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeThisReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			new CodeThisReferenceExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeThisReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 79 - 0
mcs/class/System/Test/System.CodeDom/CodeThrowExceptionStatementCas.cs

@@ -0,0 +1,79 @@
+//
+// CodeThrowExceptionStatementCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeThrowExceptionStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeThrowExceptionStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeThrowExceptionStatement ctes = new CodeThrowExceptionStatement ();
+			Assert.IsNull (ctes.ToThrow, "ToThrow");
+			ctes.ToThrow = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeExpression to_throw = new CodeExpression ();
+			CodeThrowExceptionStatement ctes = new CodeThrowExceptionStatement (to_throw);
+			Assert.AreSame (to_throw, ctes.ToThrow, "ToThrow");
+			ctes.ToThrow = new CodeExpression ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeThrowExceptionStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 95 - 0
mcs/class/System/Test/System.CodeDom/CodeTryCatchFinallyStatementCas.cs

@@ -0,0 +1,95 @@
+//
+// CodeTryCatchFinallyStatementCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTryCatchFinallyStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTryCatchFinallyStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTryCatchFinallyStatement ctcfs = new CodeTryCatchFinallyStatement ();
+			Assert.AreEqual (0, ctcfs.CatchClauses.Count, "CatchClauses");
+			Assert.AreEqual (0, ctcfs.FinallyStatements.Count, "FinallyStatements");
+			Assert.AreEqual (0, ctcfs.TryStatements.Count, "TryStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeStatement[] try_statements = new CodeStatement[1] { new CodeStatement () };
+			CodeCatchClause[] catch_clauses = new CodeCatchClause[1] { new CodeCatchClause () };
+			CodeTryCatchFinallyStatement ctcfs = new CodeTryCatchFinallyStatement (try_statements, catch_clauses);
+			Assert.AreEqual (1, ctcfs.CatchClauses.Count, "CatchClauses");
+			Assert.AreEqual (0, ctcfs.FinallyStatements.Count, "FinallyStatements");
+			Assert.AreEqual (1, ctcfs.TryStatements.Count, "TryStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeStatement[] try_statements = new CodeStatement[1] { new CodeStatement () };
+			CodeCatchClause[] catch_clauses = new CodeCatchClause[1] { new CodeCatchClause () };
+			CodeStatement[] finally_statements = new CodeStatement[1] { new CodeStatement () };
+			CodeTryCatchFinallyStatement ctcfs = new CodeTryCatchFinallyStatement (try_statements, catch_clauses, finally_statements);
+			Assert.AreEqual (1, ctcfs.CatchClauses.Count, "CatchClauses");
+			Assert.AreEqual (1, ctcfs.FinallyStatements.Count, "FinallyStatements");
+			Assert.AreEqual (1, ctcfs.TryStatements.Count, "TryStatements");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTryCatchFinallyStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 67 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeConstructorCas.cs

@@ -0,0 +1,67 @@
+//
+// CodeTypeConstructorCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeConstructor
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeConstructorCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			new CodeTypeConstructor ();
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeConstructor).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 116 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeDeclarationCas.cs

@@ -0,0 +1,116 @@
+//
+// CodeTypeDeclarationCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeDeclaration
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeDeclarationCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		private void Handler (object sender, EventArgs e)
+		{
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeDeclaration ctd = new CodeTypeDeclaration ();
+			Assert.AreEqual (0, ctd.BaseTypes.Count, "BaseTypes");
+			Assert.IsTrue (ctd.IsClass, "IsClass");
+			ctd.IsClass = false;
+			Assert.IsFalse (ctd.IsEnum, "IsEnum");
+			ctd.IsEnum = true;
+			Assert.IsFalse (ctd.IsInterface, "IsInterface");
+			ctd.IsInterface = true;
+			Assert.IsFalse (ctd.IsStruct, "IsStruct");
+			ctd.IsStruct = true;
+			Assert.AreEqual (0, ctd.Members.Count, "Members");
+			Assert.AreEqual (TypeAttributes.Public, ctd.TypeAttributes, "TypeAttributes");
+#if NET_2_0
+			Assert.IsFalse (ctd.IsPartial, "IsPartial");
+			ctd.IsPartial = true;
+#endif
+			ctd.PopulateBaseTypes += new EventHandler (Handler);
+			ctd.PopulateBaseTypes -= new EventHandler (Handler);
+			ctd.PopulateMembers += new EventHandler (Handler);
+			ctd.PopulateMembers -= new EventHandler (Handler);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeDeclaration ctd = new CodeTypeDeclaration ("mono");
+			Assert.AreEqual (0, ctd.BaseTypes.Count, "BaseTypes");
+			Assert.IsTrue (ctd.IsClass, "IsClass");
+			ctd.IsClass = false;
+			Assert.IsFalse (ctd.IsEnum, "IsEnum");
+			ctd.IsEnum = true;
+			Assert.IsFalse (ctd.IsInterface, "IsInterface");
+			ctd.IsInterface = true;
+			Assert.IsFalse (ctd.IsStruct, "IsStruct");
+			ctd.IsStruct = true;
+			Assert.AreEqual (0, ctd.Members.Count, "Members");
+			Assert.AreEqual (TypeAttributes.Public, ctd.TypeAttributes, "TypeAttributes");
+#if NET_2_0
+			Assert.IsFalse (ctd.IsPartial, "IsPartial");
+			ctd.IsPartial = true;
+#endif
+			ctd.PopulateBaseTypes += new EventHandler (Handler);
+			ctd.PopulateBaseTypes -= new EventHandler (Handler);
+			ctd.PopulateMembers += new EventHandler (Handler);
+			ctd.PopulateMembers -= new EventHandler (Handler);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeDeclaration).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeDeclarationCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeTypeDeclarationCollectionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeDeclarationCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeDeclarationCollectionCas {
+
+		private CodeTypeDeclaration ctd;
+		private CodeTypeDeclaration[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ctd = new CodeTypeDeclaration ();
+			array = new CodeTypeDeclaration[1] { ctd };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection ();
+			Assert.AreEqual (0, coll.Add (ctd), "Add");
+			Assert.AreSame (ctd, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctd), "IndexOf");
+			coll.Insert (0, ctd);
+			coll.Remove (ctd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ctd), "Add");
+			Assert.AreSame (ctd, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctd), "IndexOf");
+			coll.Insert (0, ctd);
+			coll.Remove (ctd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeDeclarationCollection c = new CodeTypeDeclarationCollection ();
+			CodeTypeDeclarationCollection coll = new CodeTypeDeclarationCollection (c);
+			Assert.AreEqual (0, coll.Add (ctd), "Add");
+			Assert.AreSame (ctd, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctd), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctd), "IndexOf");
+			coll.Insert (0, ctd);
+			coll.Remove (ctd);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeDeclarationCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 80 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeDelegateCas.cs

@@ -0,0 +1,80 @@
+//
+// CodeTypeDelegateCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeDelegate
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeDelegateCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeDelegate ctd = new CodeTypeDelegate ();
+			Assert.AreEqual (0, ctd.Parameters.Count, "Parameters");
+			Assert.AreEqual ("System.Void", ctd.ReturnType.BaseType, "ReturnType");
+			ctd.ReturnType = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeDelegate ctd = new CodeTypeDelegate ("mono");
+			Assert.AreEqual (0, ctd.Parameters.Count, "Parameters");
+			Assert.AreEqual ("System.Void", ctd.ReturnType.BaseType, "ReturnType");
+			ctd.ReturnType = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeDelegate).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 80 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeMemberCas.cs

@@ -0,0 +1,80 @@
+//
+// CodeTypeMemberCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeMember
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeMemberCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeMember ctm = new CodeTypeMember ();
+			Assert.AreEqual (MemberAttributes.Private | MemberAttributes.Final, ctm.Attributes, "Attributes");
+			ctm.Attributes = MemberAttributes.Public;
+			Assert.AreEqual (0, ctm.Comments.Count, "Comments");
+			Assert.AreEqual (0, ctm.CustomAttributes.Count, "CustomAttributes");
+			ctm.CustomAttributes = new CodeAttributeDeclarationCollection ();
+			Assert.IsNull (ctm.LinePragma, "LinePragma");
+			ctm.LinePragma = new CodeLinePragma (String.Empty, Int32.MaxValue);
+			Assert.AreEqual (String.Empty, ctm.Name, "Name");
+			ctm.Name = "mono";
+#if NET_2_0
+			Assert.AreEqual (0, ctm.StartDirectives.Count, "StartDirectives");
+			Assert.AreEqual (0, ctm.EndDirectives.Count, "EndDirectives");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeMember).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeMemberCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeTypeMemberCollectionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeMemberCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeMemberCollectionCas {
+
+		private CodeTypeMember ctm;
+		private CodeTypeMember[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ctm = new CodeTypeMember ();
+			array = new CodeTypeMember[1] { ctm };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeMemberCollection coll = new CodeTypeMemberCollection ();
+			Assert.AreEqual (0, coll.Add (ctm), "Add");
+			Assert.AreSame (ctm, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctm), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctm), "IndexOf");
+			coll.Insert (0, ctm);
+			coll.Remove (ctm);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeMemberCollection coll = new CodeTypeMemberCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ctm), "Add");
+			Assert.AreSame (ctm, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctm), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctm), "IndexOf");
+			coll.Insert (0, ctm);
+			coll.Remove (ctm);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeMemberCollection c = new CodeTypeMemberCollection ();
+			CodeTypeMemberCollection coll = new CodeTypeMemberCollection (c);
+			Assert.AreEqual (0, coll.Add (ctm), "Add");
+			Assert.AreSame (ctm, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctm), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctm), "IndexOf");
+			coll.Insert (0, ctm);
+			coll.Remove (ctm);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeMemberCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 97 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeOfExpressionCas.cs

@@ -0,0 +1,97 @@
+//
+// CodeTypeOfExpressionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeOfExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeOfExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeOfExpression ctm = new CodeTypeOfExpression ();
+			Assert.AreEqual ("System.Void", ctm.Type.BaseType, "Type");
+			ctm.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Void");
+			CodeTypeOfExpression ctm = new CodeTypeOfExpression (type);
+			Assert.AreSame (type, ctm.Type, "Type");
+			ctm.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeOfExpression ctm = new CodeTypeOfExpression ("System.Int32");
+			Assert.AreEqual ("System.Int32", ctm.Type.BaseType, "Type");
+			ctm.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeTypeOfExpression ctm = new CodeTypeOfExpression (typeof (int));
+			Assert.AreEqual ("System.Int32", ctm.Type.BaseType, "Type");
+			ctm.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeOfExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 90 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeParameterCas.cs

@@ -0,0 +1,90 @@
+//
+// CodeTypeParameterCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeParameter
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeParameterCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeParameter ctp = new CodeTypeParameter ();
+			Assert.AreEqual (0, ctp.Constraints.Count, "Constraints");
+			Assert.AreEqual (0, ctp.CustomAttributes.Count, "CustomAttributes");
+			Assert.IsFalse (ctp.HasConstructorConstraint, "HasConstructorConstraint");
+			ctp.HasConstructorConstraint = true;
+			Assert.AreEqual (String.Empty, ctp.Name);
+			ctp.Name = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeParameter ctp = new CodeTypeParameter ("mono");
+			Assert.AreEqual (0, ctp.Constraints.Count, "Constraints");
+			Assert.AreEqual (0, ctp.CustomAttributes.Count, "CustomAttributes");
+			Assert.IsFalse (ctp.HasConstructorConstraint, "HasConstructorConstraint");
+			ctp.HasConstructorConstraint = true;
+			Assert.AreEqual ("mono", ctp.Name);
+			ctp.Name = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeParameter).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}
+
+#endif

+ 197 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeReferenceCas.cs

@@ -0,0 +1,197 @@
+//
+// CodeTypeReferenceCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeReference
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeReferenceCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ();
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			ctr.ArrayElementType = new CodeTypeReference ();
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayRank = 1;
+			Assert.AreEqual (String.Empty, ctr.BaseType, "BaseType");
+			ctr.BaseType = "System.Void";
+			Assert.AreEqual ((CodeTypeReferenceOptions)0, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GlobalReference;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Int32");
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			ctr.ArrayElementType = new CodeTypeReference ("System.String");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			ctr.BaseType = String.Empty;
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayRank = 1;
+#if NET_2_0
+			Assert.AreEqual ((CodeTypeReferenceOptions) 0, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference (typeof (int));
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			ctr.ArrayElementType = new CodeTypeReference ("System.String");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			ctr.BaseType = String.Empty;
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayRank = 1;
+#if NET_2_0
+			Assert.AreEqual ((CodeTypeReferenceOptions) 0, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+#endif
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeTypeReference array = new CodeTypeReference ("System.Int32");
+			CodeTypeReference ctr = new CodeTypeReference (array, 1);
+			Assert.AreSame (array, ctr.ArrayElementType, "ArrayElementType");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			Assert.AreEqual (1, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayElementType = new CodeTypeReference ("System.String");
+			ctr.BaseType = String.Empty;
+			ctr.ArrayRank = 0;
+#if NET_2_0
+			Assert.AreEqual ((CodeTypeReferenceOptions) 0, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+#endif
+		}
+#if NET_2_0
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor4_Deny_Unrestricted ()
+		{
+			CodeTypeParameter parameter = new CodeTypeParameter ("System.Int32");
+			CodeTypeReference ctr = new CodeTypeReference (parameter);
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayElementType = new CodeTypeReference ();
+			ctr.BaseType = String.Empty;
+			ctr.ArrayRank = 1;
+			Assert.AreEqual (CodeTypeReferenceOptions.GenericTypeParameter, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GlobalReference;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor5_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference ("System.Int32", CodeTypeReferenceOptions.GlobalReference);
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayElementType = new CodeTypeReference ();
+			ctr.BaseType = String.Empty;
+			ctr.ArrayRank = 1;
+			Assert.AreEqual (CodeTypeReferenceOptions.GlobalReference, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor6_Deny_Unrestricted ()
+		{
+			CodeTypeReference ctr = new CodeTypeReference (typeof (int), CodeTypeReferenceOptions.GlobalReference);
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			Assert.AreEqual ("System.Int32", ctr.BaseType, "BaseType");
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayElementType = new CodeTypeReference ();
+			ctr.BaseType = String.Empty;
+			ctr.ArrayRank = 1;
+			Assert.AreEqual (CodeTypeReferenceOptions.GlobalReference, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (0, ctr.TypeArguments.Count, "TypeArguments");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor7_Deny_Unrestricted ()
+		{
+			CodeTypeReference[] arguments = new CodeTypeReference[1] { new CodeTypeReference ("System.Int32") };
+			CodeTypeReference ctr = new CodeTypeReference ("System.Int32", arguments);
+			Assert.IsNull (ctr.ArrayElementType, "ArrayElementType");
+			Assert.AreEqual ("System.Int32`1", ctr.BaseType, "BaseType");
+			Assert.AreEqual (0, ctr.ArrayRank, "ArrayRank");
+			ctr.ArrayElementType = new CodeTypeReference ();
+			ctr.BaseType = String.Empty;
+			ctr.ArrayRank = 1;
+			Assert.AreEqual ((CodeTypeReferenceOptions) 0, ctr.Options, "Options");
+			ctr.Options = CodeTypeReferenceOptions.GenericTypeParameter;
+			Assert.AreEqual (1, ctr.TypeArguments.Count, "TypeArguments");
+		}
+#endif
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeReference).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 119 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeReferenceCollectionCas.cs

@@ -0,0 +1,119 @@
+//
+// CodeTypeReferenceCollectionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeReferenceCollection
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeReferenceCollectionCas {
+
+		private CodeTypeReference ctr;
+		private CodeTypeReference[] array;
+
+		[TestFixtureSetUp]
+		public void FixtureSetUp ()
+		{
+			ctr = new CodeTypeReference ("System.Void");
+			array = new CodeTypeReference[1] { ctr };
+		}
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection ();
+			Assert.AreEqual (0, coll.Add (ctr), "Add");
+			Assert.AreSame (ctr, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctr), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctr), "IndexOf");
+			coll.Insert (0, ctr);
+			coll.Remove (ctr);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (array);
+			coll.CopyTo (array, 0);
+			Assert.AreEqual (1, coll.Add (ctr), "Add");
+			Assert.AreSame (ctr, coll[0], "this[int]");
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctr), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctr), "IndexOf");
+			coll.Insert (0, ctr);
+			coll.Remove (ctr);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceCollection c = new CodeTypeReferenceCollection ();
+			CodeTypeReferenceCollection coll = new CodeTypeReferenceCollection (c);
+			Assert.AreEqual (0, coll.Add (ctr), "Add");
+			Assert.AreSame (ctr, coll[0], "this[int]");
+			coll.CopyTo (array, 0);
+			coll.AddRange (array);
+			coll.AddRange (coll);
+			Assert.IsTrue (coll.Contains (ctr), "Contains");
+			Assert.AreEqual (0, coll.IndexOf (ctr), "IndexOf");
+			coll.Insert (0, ctr);
+			coll.Remove (ctr);
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeReferenceCollection).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 97 - 0
mcs/class/System/Test/System.CodeDom/CodeTypeReferenceExpressionCas.cs

@@ -0,0 +1,97 @@
+//
+// CodeTypeReferenceExpressionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeTypeReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeTypeReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression ();
+			Assert.AreEqual ("System.Void", ctre.Type.BaseType, "Type");
+			ctre.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Int32");
+			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression (type);
+			Assert.AreSame (type, ctre.Type, "Type");
+			ctre.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression ("System.Int32");
+			Assert.AreEqual ("System.Int32", ctre.Type.BaseType, "Type");
+			ctre.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeTypeReferenceExpression ctre = new CodeTypeReferenceExpression (typeof (int));
+			Assert.AreEqual ("System.Int32", ctre.Type.BaseType, "Type");
+			ctre.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeTypeReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 156 - 0
mcs/class/System/Test/System.CodeDom/CodeVariableDeclarationStatementCas.cs

@@ -0,0 +1,156 @@
+//
+// CodeVariableDeclarationStatementCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeVariableDeclarationStatement
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeVariableDeclarationStatementCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement ();
+			Assert.IsNull (cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual (String.Empty, cvds.Name, "Name");
+			cvds.Name = "mono";
+			Assert.AreEqual ("System.Void", cvds.Type.BaseType, "Type");
+			cvds.Type = new CodeTypeReference ("System.Int32");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Int32");
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement (type, "mono");
+			Assert.IsNull (cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreSame (type, cvds.Type, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor2_Deny_Unrestricted ()
+		{
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement ("System.Int32", "mono");
+			Assert.IsNull (cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cvds.Type.BaseType, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor3_Deny_Unrestricted ()
+		{
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement (typeof (int), "mono");
+			Assert.IsNull (cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cvds.Type.BaseType, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor4_Deny_Unrestricted ()
+		{
+			CodeTypeReference type = new CodeTypeReference ("System.Int32");
+			CodeExpression init = new CodeExpression ();
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement (type, "mono", init);
+			Assert.AreSame (init, cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreSame (type, cvds.Type, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor5_Deny_Unrestricted ()
+		{
+			CodeExpression init = new CodeExpression ();
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement ("System.Int32", "mono", init);
+			Assert.AreSame (init, cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cvds.Type.BaseType, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor6_Deny_Unrestricted ()
+		{
+			CodeExpression init = new CodeExpression ();
+			CodeVariableDeclarationStatement cvds = new CodeVariableDeclarationStatement (typeof (int), "mono", init);
+			Assert.AreSame (init, cvds.InitExpression, "InitExpression");
+			cvds.InitExpression = new CodeExpression ();
+			Assert.AreEqual ("mono", cvds.Name, "Name");
+			cvds.Name = String.Empty;
+			Assert.AreEqual ("System.Int32", cvds.Type.BaseType, "Type");
+			cvds.Type = new CodeTypeReference ("System.Void");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeVariableDeclarationStatement).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}

+ 78 - 0
mcs/class/System/Test/System.CodeDom/CodeVariableReferenceExpressionCas.cs

@@ -0,0 +1,78 @@
+//
+// CodeVariableReferenceExpressionCas.cs 
+//	- CAS unit tests for System.CodeDom.CodeVariableReferenceExpression
+//
+// Author:
+//	Sebastien Pouliot  <[email protected]>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using NUnit.Framework;
+
+using System;
+using System.CodeDom;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace MonoCasTests.System.CodeDom {
+
+	[TestFixture]
+	[Category ("CAS")]
+	public class CodeVariableReferenceExpressionCas {
+
+		[SetUp]
+		public void SetUp ()
+		{
+			if (!SecurityManager.SecurityEnabled)
+				Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor0_Deny_Unrestricted ()
+		{
+			CodeVariableReferenceExpression cvre = new CodeVariableReferenceExpression ();
+			Assert.AreEqual (String.Empty, cvre.VariableName, "VariableName");
+			cvre.VariableName = "mono";
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void Constructor1_Deny_Unrestricted ()
+		{
+			CodeVariableReferenceExpression cvre = new CodeVariableReferenceExpression ("mono");
+			Assert.AreEqual ("mono", cvre.VariableName, "VariableName");
+			cvre.VariableName = String.Empty;
+		}
+
+		[Test]
+		[PermissionSet (SecurityAction.Deny, Unrestricted = true)]
+		public void LinkDemand_Deny_Unrestricted ()
+		{
+			ConstructorInfo ci = typeof (CodeVariableReferenceExpression).GetConstructor (new Type[0]);
+			Assert.IsNotNull (ci, "default .ctor");
+			Assert.IsNotNull (ci.Invoke (null), "invoke");
+		}
+	}
+}