Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,235 @@
2009-08-13 Marek Habersack <mhabersack@novell.com>
* CodeTypeReferenceTest.cs: added test for bug #523341
2007-01-25 Ilya Kharmatsky <ilyak -at- mainsoft.com>
* CodeTypeReferenceTest.cs :
Added 'Ignore' attributes for several tests, under TARGET_JVM
directive, in order to workaround the Grasshopper's bugs.
2007-01-18 Atsushi Enomoto <atsushi@ximian.com>
* CodeTypeReferenceTest.cs :
Fixed generic type tests and let them involved in the actual tests.
Added some more generic type tests, including generic type
definition.
2005-11-30 Gert Driesen <drieseng@users.sourceforge.net>
* CodeRemoveEventStatementTest.cs: Added tests for ctors.
2005-11-20 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeParameterCollectionTest.cs: Improve coverage of AddRange
test. Added Remove tests.
* CodeParameterDeclarationExpressionCollectionTest.cs: Same.
* CodeCatchClauseCollectionTest.cs: Same.
* CodeStatementCollectionTest.cs: Same.
* CodeTypeMemberCollectionTest.cs: Same.
* CodeExpressionCollectionTest.cs: Same.
* CodeTypeReferenceCollectionTest.cs: Same.
* CodeCommentStatementCollectionTest.cs: Same.
* CodeAttributeArgumentCollectionTest.cs: Same.
* CodeAttributeDeclarationCollectionTest.cs: Same.
* CodeDirectiveCollectionTest.cs: Same.
* CodeTypeDeclarationCollectionTest.cs: Same.
* CodeNamespaceCollectionTest.cs: Same.
2005-11-20 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeParameterCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeCatchClauseCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeStatementCollectionTest.cs: Added AddRange test for null item.
* CodeTypeMemberCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeCommentStatementCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeAttributeArgumentCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeAttributeDeclarationCollectionTest.cs: Added tests for ctors,
and Add/AddRange/Insert methods.
* CodeDirectiveCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeTypeDeclarationCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
* CodeNamespaceImportCollectionTest.cs: Added tests for ctor, Add and
AddRange methods.
* CodeNamespaceCollectionTest.cs: Added tests for ctors, and
Add/AddRange/Insert methods.
2005-11-09 Gert Driesen <drieseng@users.sourceforge.net>
* CodeExpressionCollectionTest.cs: Fixed test case for AddRange_Self
to really discover regressions.
* CodeStatementCollectionTest.cs: same.
* CodeTypeReferenceCollectionTest.cs: same.
2005-11-08 Sebastien Pouliot <sebastien@ximian.com>
* CodeExpressionCollectionTest.cs: Added test case for AddRange(self).
* CodeStatementCollectionTest.cs: Added test case for AddRange(self).
* CodeTypeReferenceCollectionTest.cs: Added test case for
AddRange(self).
2005-11-08 Gert Driesen <drieseng@users.sourceforge.net>
* CodeExpressionCollectionTest.cs: Added tests for ctors and AddRange
changes made in r52579.
* CodeParameterDeclarationExpressionCollectionTest.cs: same.
* CodeTypeReferenceCollectionTest.cs: same.
2005-11-07 Sebastien Pouliot <sebastien@ximian.com>
* CodeMethodInvokeExpressionTest.cs: Fixed some failures on 2.0
tests.
2005-11-04 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeReferenceExpressionTest.cs: Added tests.
* CodeVariableDeclarationStatementTest.cs: Added tests.
* CodePropertyReferenceExpressionTest.cs: Added tests.
* CodeNamespaceImportTest.cs: Added tests.
* CodeTypeConstructorTest.cs: Added tests.
* CodeSnippetExpressionTest.cs: Added tests.
* CodeParameterDeclarationExpressionTest.cs: Added tests.
* CodeObjectCreateExpressionTest.cs: Added tests.
* CodeTypeDelegateTest.cs: Set eol-style to native.
* CodeLabeledStatementTest.cs: Added tests.
* CodeConstructorTest.cs: Added tests.
* CodeTypeOfExpressionTest.cs: Added tests.
* CodeGotoStatementTest.cs: Added tests.
* CodeCastExpressionTest.cs: Added tests.
* CodeMemberFieldTest.cs: Set eol-style to native.
* CodeMethodInvokeExpressionTest.cs: Added tests.
* CodeEventReferenceExpressionTest.cs: Added tests.
* CodeChecksumPragmaTest.cs: Added tests.
* CodeSnippetCompileUnitTest.cs: Added tests.
* CodeNamespaceTest.cs: Added tests.
* CodeSnippetStatementTest.cs: Added tests.
* CodeMemberMethodTest.cs: Added tests.
* CodeMemberPropertyTest.cs: Set eol-style to native.
* CodeCatchClauseTest.cs: Added tests.
* CodeStatementCollectionTest.cs: Added tests.
* CodeRegionDirectiveTest.cs: Added tests.
* CodeTypeParameterTest.cs: Added tests.
* CodeVariableReferenceExpressionTest.cs: Added tests.
* CodeDefaultValueExpressionTest.cs: Added tests.
* CodeSnippetTypeMemberTest.cs: Added tests.
* CodeDelegateCreateExpressionTest.cs: Added tests.
* CodeLinePragmaTest.cs: Added tests.
* CodeMethodReferenceExpressionTest.cs: Added tests.
2005-10-25 Gert Driesen <drieseng@users.sourceforge.net>
* CodeArgumentReferenceExpressionTest.cs: Fixed namespace.
* CodeArrayCreateExpressionTest.cs: Fixed namespace.
* CodeAttachEventStatementTest.cs: Fixed namespace and added tests for
contructors that were not covered.
* CodeAttributeArgumentTest.cs: Fixed namespace.
* CodeAttributeDeclarationTest.cs: Fixed namespace and added tests for
constructors that were not covered.
2005-10-24 Gert Driesen <drieseng@users.sourceforge.net>
* CodeArgumentReferenceExpressionTest.cs: Added test for default ctor
and default value of ParameterName.
* CodeArrayCreateExpressionTest.cs: Added test for default ctor and
default value of CreateType.
* CodeAttachEventStatementTest.cs: Added test for default ctor and
default value of Event.
* CodeAttributeArgumentTest.cs: Added test for default ctor and
default value of Name.
* CodeAttributeDeclarationTest.cs: Added test for default ctor and
default value of Name.
2005-10-24 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeReferenceTest.cs: Enabled test case for bug #76535. Added
few additional tests for null or zero length data type of array.
2005-10-24 Sebastien Pouliot <sebastien@ximian.com>
* CodeTypeReferenceCas.cs: Fixed test cases not to trigger bug or
depend on the internal ctor.
* CodeTypeReferenceTest.cs: Added a test case for bug #76535.
2005-10-24 Sebastien Pouliot <sebastien@ximian.com>
* 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 <drieseng@users.sourceforge.net>
* CodeTypeReferenceTest.cs: Added tests for multi-dimensional
arrays.
2005-10-05 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeReferenceTest.cs: Added tests for generic types and base
types with generic type parameters.
2005-10-02 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeReferenceTest.cs: Added tests for CodeTypeParameter ctor,
and string (basetype) ctor.
2005-07-24 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeDelegateTest.cs: Added tests for BaseTypes and ReturnType.
2005-06-28 Gert Driesen <drieseng@users.sourceforge.net>
* CodeTypeReferenceTest.cs: Tests for zero-length and null type names,
and null type.
2005-06-26 Gert Driesen <drieseng@users.sourceforge.net>
* CodeMemberPropertyTest.cs: Test for default value of Type property.
2005-06-25 Gert Driesen <drieseng@users.sourceforge.net>
* CodeMemberFieldTest.cs: Test for default value of Type property.

View File

@@ -0,0 +1,78 @@
//
// CodeArgumentReferenceExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeArgumentReferenceExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,56 @@
//
// CodeArgumentReferenceExpressionTest.cs
// - Unit tests for System.CodeDom.CodeArgumentReferenceExpression
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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;
namespace MonoTests.System.CodeDom {
[TestFixture]
public class CodeArgumentReferenceExpressionTest {
[Test]
public void DefaultConstructor ()
{
CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ();
Assert.AreEqual (string.Empty, care.ParameterName, "#1");
care.ParameterName = "mono";
Assert.AreEqual ("mono", care.ParameterName, "#2");
}
[Test]
public void NullParameter ()
{
CodeArgumentReferenceExpression care = new CodeArgumentReferenceExpression ((string) null);
Assert.AreEqual (string.Empty, care.ParameterName, "#1");
care.ParameterName = null;
Assert.AreEqual (string.Empty, care.ParameterName, "#2");
}
}
}

View File

@@ -0,0 +1,188 @@
//
// CodeArrayCreateExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeArrayCreateExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,60 @@
//
// CodeArrayCreateExpressionTest.cs
// - Unit tests for System.CodeDom.CodeArrayCreateExpression
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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;
namespace MonoTests.System.CodeDom
{
[TestFixture]
public class CodeArrayCreateExpressionTest
{
[Test]
public void DefaultConstructor ()
{
CodeArrayCreateExpression cace = new CodeArrayCreateExpression ();
Assert.IsNotNull (cace.CreateType, "#1");
Assert.AreEqual (typeof (void).FullName, cace.CreateType.BaseType, "#2");
}
[Test]
public void NullCreateType ()
{
CodeArrayCreateExpression cace = new CodeArrayCreateExpression ((CodeTypeReference) null, 0);
Assert.IsNotNull (cace.CreateType, "#1");
Assert.AreEqual (typeof (void).FullName, cace.CreateType.BaseType, "#2");
cace.CreateType = null;
Assert.IsNotNull (cace.CreateType, "#3");
Assert.AreEqual (typeof (void).FullName, cace.CreateType.BaseType, "#4");
}
}
}

View File

@@ -0,0 +1,82 @@
//
// CodeArrayIndexerExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeArrayIndexerExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,84 @@
//
// CodeAssignStatementCas.cs
// - CAS unit tests for System.CodeDom.CodeAssignStatement
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,100 @@
//
// CodeAttachEventStatementCas.cs
// - CAS unit tests for System.CodeDom.CodeAttachEventStatement
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,98 @@
//
// CodeAttachEventStatementTest.cs
// - Unit tests for System.CodeDom.CodeAttachEventStatement
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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;
namespace MonoTests.System.CodeDom
{
[TestFixture]
public class CodeAttachEventStatementTest
{
[Test]
public void Constructor0 ()
{
CodeAttachEventStatement caes = new CodeAttachEventStatement ();
Assert.IsNotNull (caes.Event, "#1");
Assert.IsNull (caes.Listener, "#2");
Assert.AreEqual (string.Empty, caes.Event.EventName, "#3");
Assert.IsNull (caes.Event.TargetObject, "#4");
}
[Test]
public void Constructor1 ()
{
CodeEventReferenceExpression eventref = new CodeEventReferenceExpression ();
CodeExpression listener = new CodeExpression ();
CodeAttachEventStatement caes = new CodeAttachEventStatement (eventref, listener);
Assert.AreSame (eventref, caes.Event, "#1");
Assert.AreEqual (string.Empty, caes.Event.EventName, "#2");
Assert.IsNull (caes.Event.TargetObject, "#3");
Assert.AreSame (listener, caes.Listener, "#4");
caes.Event = null;
Assert.IsNotNull (caes.Event, "#5");
Assert.AreEqual (string.Empty, caes.Event.EventName, "#6");
Assert.IsNull (caes.Event.TargetObject, "#7");
Assert.AreSame (listener, caes.Listener, "#8");
caes.Listener = null;
Assert.IsNull (caes.Listener, "#9");
caes.Event = eventref;
Assert.AreSame (eventref, caes.Event, "#10");
caes.Listener = listener;
Assert.AreSame (listener, caes.Listener, "#11");
caes = new CodeAttachEventStatement ((CodeEventReferenceExpression) null, (CodeExpression) null);
Assert.IsNotNull (caes.Event, "#12");
Assert.IsNull (caes.Listener, "#13");
Assert.AreEqual (string.Empty, caes.Event.EventName, "#14");
Assert.IsNull (caes.Event.TargetObject, "#15");
}
[Test]
public void Constructor2 ()
{
CodeExpression targetObject = new CodeExpression ();
CodeExpression listener = new CodeExpression ();
CodeAttachEventStatement caes = new CodeAttachEventStatement (targetObject, "mono", listener);
Assert.IsNotNull (caes.Event, "#1");
Assert.AreEqual ("mono", caes.Event.EventName, "#2");
Assert.AreSame (targetObject, caes.Event.TargetObject, "#3");
Assert.AreSame (listener, caes.Listener, "#4");
}
}
}

View File

@@ -0,0 +1,95 @@
//
// CodeAttributeArgumentCas.cs
// - CAS unit tests for System.CodeDom.CodeAttributeArgument
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,119 @@
//
// CodeAttributeArgumentCollectionCas.cs
// - CAS unit tests for System.CodeDom.CodeAttributeArgumentCollection
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,250 @@
//
// CodeAttributeArgumentCollectionTest.cs
// - Unit tests for System.CodeDom.CodeAttributeArgumentCollection
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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.Collections;
using System.CodeDom;
namespace MonoTests.System.CodeDom {
[TestFixture]
public class CodeAttributeArgumentCollectionTest {
[Test]
public void Constructor0 ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
Assert.AreEqual (0, coll.Count, "#3");
Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
Assert.IsNotNull (((ICollection) coll).SyncRoot, "#5");
}
[Test]
public void Constructor1 ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgument[] arguments = new CodeAttributeArgument[] { caa1, caa2 };
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (
arguments);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (caa1), "#2");
Assert.AreEqual (1, coll.IndexOf (caa2), "#3");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor1_NullItem ()
{
CodeAttributeArgument[] arguments = new CodeAttributeArgument[] {
new CodeAttributeArgument (), null };
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (
arguments);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor1_Null () {
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (
(CodeAttributeArgument[]) null);
}
[Test]
public void Constructor2 ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgumentCollection c = new CodeAttributeArgumentCollection ();
c.Add (caa1);
c.Add (caa2);
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (c);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (caa1), "#2");
Assert.AreEqual (1, coll.IndexOf (caa2), "#3");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor2_Null ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection (
(CodeAttributeArgumentCollection) null);
}
[Test]
public void Add ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
Assert.AreEqual (0, coll.Add (caa1), "#1");
Assert.AreEqual (1, coll.Count, "#2");
Assert.AreEqual (0, coll.IndexOf (caa1), "#3");
Assert.AreEqual (1, coll.Add (caa2), "#4");
Assert.AreEqual (2, coll.Count, "#5");
Assert.AreEqual (1, coll.IndexOf (caa2), "#6");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Add_Null () {
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Add ((CodeAttributeArgument) null);
}
[Test]
public void Insert ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Add (caa1);
Assert.AreEqual (1, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (caa1), "#2");
coll.Insert (0, caa2);
Assert.AreEqual (2, coll.Count, "#3");
Assert.AreEqual (1, coll.IndexOf (caa1), "#4");
Assert.AreEqual (0, coll.IndexOf (caa2), "#5");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Insert_Null ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Insert (0, (CodeAttributeArgument) null);
}
[Test]
public void AddRange ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgument caa3 = new CodeAttributeArgument ();
CodeAttributeArgumentCollection coll1 = new CodeAttributeArgumentCollection ();
coll1.Add (caa1);
coll1.Add (caa2);
CodeAttributeArgumentCollection coll2 = new CodeAttributeArgumentCollection();
coll2.Add (caa3);
coll2.AddRange (coll1);
Assert.AreEqual (3, coll2.Count, "#1");
Assert.AreEqual (1, coll2.IndexOf (caa1), "#2");
Assert.AreEqual (2, coll2.IndexOf (caa2), "#3");
Assert.AreEqual (0, coll2.IndexOf (caa3), "#4");
CodeAttributeArgumentCollection coll3 = new CodeAttributeArgumentCollection();
coll3.Add (caa3);
coll3.AddRange (new CodeAttributeArgument[] {caa1, caa2});
Assert.AreEqual (3, coll2.Count, "#5");
Assert.AreEqual (1, coll2.IndexOf (caa1), "#6");
Assert.AreEqual (2, coll2.IndexOf (caa2), "#7");
Assert.AreEqual (0, coll2.IndexOf (caa3), "#8");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Array ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.AddRange ((CodeAttributeArgument[]) null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Item ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.AddRange (new CodeAttributeArgument[] { null });
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Collection ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.AddRange ((CodeAttributeArgumentCollection) null);
}
[Test]
public void AddRange_Self ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Add (new CodeAttributeArgument ());
Assert.AreEqual (1, coll.Count, "#1");
coll.AddRange (coll);
Assert.AreEqual (2, coll.Count, "#2");
}
[Test]
public void Remove ()
{
CodeAttributeArgument caa1 = new CodeAttributeArgument ();
CodeAttributeArgument caa2 = new CodeAttributeArgument ();
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Add (caa1);
coll.Add (caa2);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (caa1), "#2");
Assert.AreEqual (1, coll.IndexOf (caa2), "#3");
coll.Remove (caa1);
Assert.AreEqual (1, coll.Count, "#4");
Assert.AreEqual (-1, coll.IndexOf (caa1), "#5");
Assert.AreEqual (0, coll.IndexOf (caa2), "#6");
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Remove_NotInCollection ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Remove (new CodeAttributeArgument ());
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Remove_Null ()
{
CodeAttributeArgumentCollection coll = new CodeAttributeArgumentCollection ();
coll.Remove ((CodeAttributeArgument) null);
}
}
}

View File

@@ -0,0 +1,62 @@
//
// CodeAttributeArgumentTest.cs
// - Unit tests for System.CodeDom.CodeAttributeArgument
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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;
namespace MonoTests.System.CodeDom
{
[TestFixture]
public class CodeAttributeArgumentTest
{
[Test]
public void DefaultConstructor ()
{
CodeAttributeArgument caa = new CodeAttributeArgument ();
Assert.IsNotNull (caa.Name, "#1");
Assert.AreEqual (string.Empty, caa.Name, "#2");
Assert.IsNull (caa.Value, "#3");
}
[Test]
public void NullName ()
{
CodeAttributeArgument caa = new CodeAttributeArgument ((string) null, (CodeExpression) null);
Assert.IsNotNull (caa.Name, "#1");
Assert.AreEqual (string.Empty, caa.Name, "#2");
Assert.IsNull (caa.Value, "#3");
caa.Name = null;
Assert.IsNotNull (caa.Name, "#4");
Assert.AreEqual (string.Empty, caa.Name, "#5");
}
}
}

View File

@@ -0,0 +1,125 @@
//
// CodeAttributeDeclarationCas.cs
// - CAS unit tests for System.CodeDom.CodeAttributeDeclaration
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,119 @@
//
// CodeAttributeDeclarationCollectionCas.cs
// - CAS unit tests for System.CodeDom.CodeAttributeDeclarationCollection
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,250 @@
//
// CodeAttributeDeclarationCollectionTest.cs
// - Unit tests for System.CodeDom.CodeAttributeDeclarationCollection
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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.Collections;
using System.CodeDom;
namespace MonoTests.System.CodeDom {
[TestFixture]
public class CodeAttributeDeclarationCollectionTest {
[Test]
public void Constructor0 ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
Assert.IsFalse (((IList) coll).IsFixedSize, "#1");
Assert.IsFalse (((IList) coll).IsReadOnly, "#2");
Assert.AreEqual (0, coll.Count, "#3");
Assert.IsFalse (((ICollection) coll).IsSynchronized, "#4");
Assert.IsNotNull (((ICollection) coll).SyncRoot, "#5");
}
[Test]
public void Constructor1 ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration[] declarations = new CodeAttributeDeclaration[] { cad1, cad2 };
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
declarations);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (cad1), "#2");
Assert.AreEqual (1, coll.IndexOf (cad2), "#3");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor1_NullItem ()
{
CodeAttributeDeclaration[] declarations = new CodeAttributeDeclaration[] {
new CodeAttributeDeclaration (), null };
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
declarations);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor1_Null () {
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
(CodeAttributeDeclaration[]) null);
}
[Test]
public void Constructor2 ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclarationCollection c = new CodeAttributeDeclarationCollection ();
c.Add (cad1);
c.Add (cad2);
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (c);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (cad1), "#2");
Assert.AreEqual (1, coll.IndexOf (cad2), "#3");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Constructor2_Null ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection (
(CodeAttributeDeclarationCollection) null);
}
[Test]
public void Add ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
Assert.AreEqual (0, coll.Add (cad1), "#1");
Assert.AreEqual (1, coll.Count, "#2");
Assert.AreEqual (0, coll.IndexOf (cad1), "#3");
Assert.AreEqual (1, coll.Add (cad2), "#4");
Assert.AreEqual (2, coll.Count, "#5");
Assert.AreEqual (1, coll.IndexOf (cad2), "#6");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Add_Null () {
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Add ((CodeAttributeDeclaration) null);
}
[Test]
public void Insert ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Add (cad1);
Assert.AreEqual (1, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (cad1), "#2");
coll.Insert (0, cad2);
Assert.AreEqual (2, coll.Count, "#3");
Assert.AreEqual (1, coll.IndexOf (cad1), "#4");
Assert.AreEqual (0, coll.IndexOf (cad2), "#5");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Insert_Null ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Insert (0, (CodeAttributeDeclaration) null);
}
[Test]
public void AddRange ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad3 = new CodeAttributeDeclaration ();
CodeAttributeDeclarationCollection coll1 = new CodeAttributeDeclarationCollection ();
coll1.Add (cad1);
coll1.Add (cad2);
CodeAttributeDeclarationCollection coll2 = new CodeAttributeDeclarationCollection ();
coll2.Add (cad3);
coll2.AddRange (coll1);
Assert.AreEqual (3, coll2.Count, "#1");
Assert.AreEqual (1, coll2.IndexOf (cad1), "#2");
Assert.AreEqual (2, coll2.IndexOf (cad2), "#3");
Assert.AreEqual (0, coll2.IndexOf (cad3), "#4");
CodeAttributeDeclarationCollection coll3 = new CodeAttributeDeclarationCollection ();
coll3.Add (cad3);
coll3.AddRange (new CodeAttributeDeclaration[] { cad1, cad2 });
Assert.AreEqual (3, coll2.Count, "#5");
Assert.AreEqual (1, coll2.IndexOf (cad1), "#6");
Assert.AreEqual (2, coll2.IndexOf (cad2), "#7");
Assert.AreEqual (0, coll2.IndexOf (cad3), "#8");
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Array ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.AddRange ((CodeAttributeDeclaration[]) null);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Item ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.AddRange (new CodeAttributeDeclaration[] { null });
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AddRange_Null_Collection ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.AddRange ((CodeAttributeDeclarationCollection) null);
}
[Test]
public void AddRange_Self ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Add (new CodeAttributeDeclaration ());
Assert.AreEqual (1, coll.Count, "#1");
coll.AddRange (coll);
Assert.AreEqual (2, coll.Count, "#2");
}
[Test]
public void Remove ()
{
CodeAttributeDeclaration cad1 = new CodeAttributeDeclaration ();
CodeAttributeDeclaration cad2 = new CodeAttributeDeclaration ();
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Add (cad1);
coll.Add (cad2);
Assert.AreEqual (2, coll.Count, "#1");
Assert.AreEqual (0, coll.IndexOf (cad1), "#2");
Assert.AreEqual (1, coll.IndexOf (cad2), "#3");
coll.Remove (cad1);
Assert.AreEqual (1, coll.Count, "#4");
Assert.AreEqual (-1, coll.IndexOf (cad1), "#5");
Assert.AreEqual (0, coll.IndexOf (cad2), "#6");
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Remove_NotInCollection ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Remove (new CodeAttributeDeclaration ());
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void Remove_Null ()
{
CodeAttributeDeclarationCollection coll = new CodeAttributeDeclarationCollection ();
coll.Remove ((CodeAttributeDeclaration) null);
}
}
}

View File

@@ -0,0 +1,162 @@
//
// CodeAttributeDeclarationTest.cs
// - Unit tests for System.CodeDom.CodeAttributeDeclaration
//
// Author:
// Gert Driesen <drieseng@users.sourceforge.net>
//
// 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;
namespace MonoTests.System.CodeDom
{
[TestFixture]
public class CodeAttributeDeclarationTest
{
[Test]
public void NullName ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration ((string) null);
Assert.IsNotNull (cad.Name, "#1");
Assert.AreEqual (string.Empty, cad.Name, "#2");
#if NET_2_0
Assert.IsNotNull (cad.AttributeType, "#3");
Assert.AreEqual (typeof(void).FullName, cad.AttributeType.BaseType, "#4");
#endif
Assert.IsNotNull (cad.Arguments, "#5");
Assert.AreEqual (0, cad.Arguments.Count, "#6");
cad.Name = null;
Assert.IsNotNull (cad.Name, "#7");
Assert.AreEqual (string.Empty, cad.Name, "#8");
#if NET_2_0
Assert.IsNotNull (cad.AttributeType, "#9");
Assert.AreEqual (typeof(void).FullName, cad.AttributeType.BaseType, "#10");
#endif
}
[Test]
public void Constructor0 ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration ();
Assert.IsNotNull (cad.Name, "#1");
Assert.AreEqual (string.Empty, cad.Name, "#2");
#if NET_2_0
Assert.IsNull (cad.AttributeType, "#3");
#endif
Assert.IsNotNull (cad.Arguments, "#4");
Assert.AreEqual (0, cad.Arguments.Count, "#5");
}
[Test]
public void Constructor1 ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration ("mono");
Assert.AreEqual (0, cad.Arguments.Count, "#1");
Assert.AreEqual ("mono", cad.Name, "#2");
#if NET_2_0
Assert.IsNotNull (cad.AttributeType, "#3");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#4");
#endif
}
[Test]
public void Constructor2 ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration ("mono", new CodeAttributeArgument ());
Assert.AreEqual (1, cad.Arguments.Count, "#1");
Assert.AreEqual ("mono", cad.Name, "#2");
#if NET_2_0
Assert.IsNotNull (cad.AttributeType, "#3");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#4");
#endif
cad.Name = null;
Assert.AreEqual (1, cad.Arguments.Count, "#5");
Assert.AreEqual (string.Empty, cad.Name, "#6");
#if NET_2_0
Assert.IsNotNull (cad.AttributeType, "#7");
Assert.AreEqual (typeof(void).FullName, cad.AttributeType.BaseType, "#8");
#endif
}
#if NET_2_0
[Test]
public void Constructor3 ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration (new CodeTypeReference ("mono"));
Assert.AreEqual (0, cad.Arguments.Count, "#1");
Assert.AreEqual ("mono", cad.Name, "#2");
Assert.IsNotNull (cad.AttributeType, "#3");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#4");
cad.Name = null;
Assert.AreEqual (0, cad.Arguments.Count, "#5");
Assert.AreEqual (string.Empty, cad.Name, "#6");
Assert.AreEqual (typeof(void).FullName, cad.AttributeType.BaseType, "#7");
cad.Name = "mono";
Assert.AreEqual (0, cad.Arguments.Count, "#8");
Assert.AreEqual ("mono", cad.Name, "#9");
Assert.IsNotNull (cad.AttributeType, "#10");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#11");
cad = new CodeAttributeDeclaration ((CodeTypeReference) null);
Assert.AreEqual (0, cad.Arguments.Count, "#12");
Assert.AreEqual (string.Empty, cad.Name, "#13");
Assert.IsNull (cad.AttributeType, "#14");
}
[Test]
public void Constructor4 ()
{
CodeAttributeDeclaration cad = new CodeAttributeDeclaration (new CodeTypeReference ("mono"),
new CodeAttributeArgument (), new CodeAttributeArgument ());
Assert.AreEqual (2, cad.Arguments.Count, "#1");
Assert.AreEqual ("mono", cad.Name, "#2");
Assert.IsNotNull (cad.AttributeType, "#3");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#4");
cad.Name = null;
Assert.AreEqual (2, cad.Arguments.Count, "#5");
Assert.AreEqual (string.Empty, cad.Name, "#6");
Assert.AreEqual (typeof(void).FullName, cad.AttributeType.BaseType, "#7");
cad.Name = "mono";
Assert.AreEqual (2, cad.Arguments.Count, "#8");
Assert.AreEqual ("mono", cad.Name, "#9");
Assert.IsNotNull (cad.AttributeType, "#10");
Assert.AreEqual ("mono", cad.AttributeType.BaseType, "#11");
cad = new CodeAttributeDeclaration ((CodeTypeReference) null,
new CodeAttributeArgument ());
Assert.AreEqual (1, cad.Arguments.Count, "#12");
Assert.AreEqual (string.Empty, cad.Name, "#13");
Assert.IsNull (cad.AttributeType, "#14");
}
#endif
}
}

View File

@@ -0,0 +1,67 @@
//
// CodeBaseReferenceExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeBaseReferenceExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,89 @@
//
// CodeBinaryOperatorExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeBinaryOperatorExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

View File

@@ -0,0 +1,84 @@
//
// CodeCastExpressionCas.cs
// - CAS unit tests for System.CodeDom.CodeCastExpression
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// 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");
}
}
}

Some files were not shown because too many files have changed in this diff Show More