src/Castle.Core.Tests/DynamicProxy.Tests/CustomModifiersTestCase.cs
/// <summary>
/// This test checks whether reflection correctly reports back the modopts on
/// the parameter type in the generated types.
/// </summary>
This test checks whether reflection correctly reports back the modopts on
the parameter type in the generated types.
This test checks whether reflection correctly reports back the modopts on the parameter type in the generated types .
[TestCaseSource(nameof(AsModoptOnReturnTypeNames))]
		public void ReflectionReturnsCorrectModoptOnReturnTypeForGeneratedType(string typeName)
		{
			Assume.That(this.generatedTypes.ContainsKey(typeName));
			const string suffix = "_AsModoptOnReturnType";
			Assume.That(typeName.EndsWith(suffix));
			var typeNameWithoutSuffix = typeName.Substring(0, typeName.Length - suffix.Length);
			Assume.That(CustomModifiersTestCase.customModifiers.ContainsKey(typeNameWithoutSuffix));
			var modopts = this.generatedTypes[typeName].GetMethod("Foo").ReturnParameter.GetOptionalCustomModifiers();
			Assume.That(modopts.Length > 0); 
			CollectionAssert.AreEqual(expected: CustomModifiersTestCase.customModifiers[typeNameWithoutSuffix].Reverse(), actual: modopts);
		}
[ TestCaseSource ( nameof ( AsModoptOnReturnTypeNames ) ) ] public void ReflectionReturnsCorrectModoptOnReturnTypeForGeneratedType ( string typeName ) { Assume . That ( this . generatedTypes . ContainsKey ( typeName ) ) ; const string suffix = " " ; Assume . That ( typeName . EndsWith ( suffix ) ) ; var typeNameWithoutSuffix = typeName . Substring ( 0 , typeName . Length - suffix . Length ) ; Assume . That ( CustomModifiersTestCase . customModifiers . ContainsKey ( typeNameWithoutSuffix ) ) ; var modopts = this . generatedTypes [ typeName ] . GetMethod ( " " ) . ReturnParameter . GetOptionalCustomModifiers ( ) ; Assume . That ( modopts . Length > 0 ) ; CollectionAssert . AreEqual ( expected : CustomModifiersTestCase . customModifiers [ typeNameWithoutSuffix ] . Reverse ( ) , actual : modopts ) ; }
This test checks whether reflection correctly reports back the modopts on
the parameter type in the generated types.
This test checks whether reflection correctly reports back the modopts on the parameter type in the generated types .
// If this fails on mono/linux we have to revisit the commits and issues for IL method custom modifiers. https://github.com/castleproject/Core/issues/277 // ^ see comment about `.Reverse()` above.
typeName
string