virtual public bool TestGetCustomAttribute_Type2 (MemberInfo mem)
{
Util.print ("\n\n" + this.GetType ().ToString () + " - TestGetCustomAttribute_Type2() started.");
Util.print ("For: " + mem.GetType ().ToString () + "\n");
string strLoc="L_111_2_000";
String str = null;
Object[] attrs = null;
try
{
do
{
iCountTestcases++;
strLoc="L_111_2_001";
iCountTestcases++;
strLoc="L_111_2_002.2";
attrs = mem.GetCustomAttributes (typeof (ClassLib_Attributes.CA_AMfalse_INfalse), true);
if (attrs == null) {
iCountErrors++;
Util.printerr ("E_111_2_gfh4 - attrs == null");
}
iCountTestcases++;
strLoc="L_111_2_002.3";
if (attrs.Length != iCountAMfalseINfalseAttrs) {
iCountErrors++;
Util.printerr ("E_111_2_jhd3 - attrs.Length != iCountAMfalseINfalseAttrs");
Util.print ("Expected: " + iCountAMfalseINfalseAttrs + ";Returned: " + attrs.Length);
}
iCountTestcases++;
strLoc="L_111_2_002.3.2";
if (!(attrs is ClassLib_Attributes.CA_AMfalse_INfalse[])) {
iCountErrors++;
Util.printerr ("E_111_2_jhd32 - attrs is ClassLib_Attributes.CA_AMfalse_INfalse[] FAiLed!");
}
if (Util.DEBUG > 0) Console.WriteLine("Number of attrs {0}", attrs.Length);
for (int i = 0; i < attrs.Length; i++) {
iCountTestcases++;
strLoc="L_111_2_001.3.2";
if (Util.DEBUG > 1) Console.WriteLine ("{0} : {1}\n\n", i, attrs[i]);
str = attrs[i].ToString ();
iCountTestcases++;
strLoc="L_111_2_001.4";
if (attrs[i] is ClassLib_Attributes.CA_AMfalse_INfalse) {
ClassLib_Attributes.CA_AMfalse_INfalse attr = (ClassLib_Attributes.CA_AMfalse_INfalse) attrs[i];
if (attr.name.Equals ("CA_AMfalse_INfalse")) {
iCountTestcases++;
strLoc="L_111_2_001.5";
if (!caAmfInf.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_2_8d2p- caAmfInf2.Equals FAiLed!");
}
}
else {
iCountErrors++;
Util.printerr ("E_111_2_iu2h- UnExpected attr.name! - " + attr.name);
}
}
else {
iCountErrors++;
Util.printerr ("E_111_2_9dus- UnExpected attr type! - " + attrs[i].GetType().ToString ());
}
}
iCountTestcases++;
strLoc="L_111_3_002.2";
attrs = mem.GetCustomAttributes (typeof (ClassLib_Attributes.CA_AMfalse_INtrue), true);
if (attrs == null) {
iCountErrors++;
Util.printerr ("E_111_3_gfh4 - attrs == null");
}
iCountTestcases++;
strLoc="L_111_3_002.3";
if (attrs.Length != iCountAMfalseINtrueAttrs) {
iCountErrors++;
Util.printerr ("E_111_3_jhd3 - attrs.Length != iCountAMfalseINtrueAttrs");
Util.print ("Expected: " + iCountAMfalseINtrueAttrs + ";Returned: " + attrs.Length);
}
iCountTestcases++;
strLoc="L_111_3_002.3.2";
if (!(attrs is ClassLib_Attributes.CA_AMfalse_INtrue[])) {
iCountErrors++;
Util.printerr ("E_111_3_jhd32 - attrs is ClassLib_Attributes.CA_AMfalse_INtrue[] FAiLed!");
}
if (Util.DEBUG > 0) Console.WriteLine("Number of attrs {0}", attrs.Length);
for (int i = 0; i < attrs.Length; i++) {
iCountTestcases++;
strLoc="L_111_3_001.3.2";
if (Util.DEBUG > 1) Console.WriteLine ("{0} : {1}\n\n", i, attrs[i]);
str = attrs[i].ToString ();
iCountTestcases++;
strLoc="L_111_3_001.4";
if (attrs[i] is ClassLib_Attributes.CA_AMfalse_INtrue) {
ClassLib_Attributes.CA_AMfalse_INtrue attr = (ClassLib_Attributes.CA_AMfalse_INtrue) attrs[i];
if (attr.name.Equals ("CA_AMfalse_INtrue")) {
iCountTestcases++;
strLoc="L_111_3_001.5";
if (!caAmfInt.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_3_8d2p- caAmfInt2.Equals FAiLed!");
}
}
else {
iCountErrors++;
Util.printerr ("E_111_3_iu2h- UnExpected attr.name! - " + attr.name);
}
}
else {
iCountErrors++;
Util.printerr ("E_111_3_9dus- UnExpected attr type! - " + attrs[i].GetType().ToString ());
}
}
iCountTestcases++;
strLoc="L_111_4_002.2";
attrs = mem.GetCustomAttributes (typeof (ClassLib_Attributes.CA_AMtrue_INtrue), true);
if (attrs == null) {
iCountErrors++;
Util.printerr ("E_111_4_gfh4 - attrs == null");
}
iCountTestcases++;
strLoc="L_111_4_002.3";
if (attrs.Length != iCountAMtrueINtrueAttrs) {
iCountErrors++;
Util.printerr ("E_111_4_jhd3 - attrs.Length != iCountAMtrueINtrueAttrs");
Util.print ("Expected: " + iCountAMtrueINtrueAttrs + ";Returned: " + attrs.Length);
}
iCountTestcases++;
strLoc="L_111_4_002.3.2";
if (!(attrs is ClassLib_Attributes.CA_AMtrue_INtrue[])) {
iCountErrors++;
Util.printerr ("E_111_4_jhd32 - attrs is ClassLib_Attributes.CA_AMtrue_INtrue[] FAiLed!");
}
if (Util.DEBUG > 0) Console.WriteLine("Number of attrs {0}", attrs.Length);
for (int i = 0; i < attrs.Length; i++) {
iCountTestcases++;
strLoc="L_111_4_001.3.2";
if (Util.DEBUG > 1) Console.WriteLine ("{0} : {1}\n\n", i, attrs[i]);
str = attrs[i].ToString ();
iCountTestcases++;
strLoc="L_111_4_001.4";
if (attrs[i] is ClassLib_Attributes.CA_AMtrue_INtrue) {
ClassLib_Attributes.CA_AMtrue_INtrue attr = (ClassLib_Attributes.CA_AMtrue_INtrue) attrs[i];
if (attr.name.Equals ("CA_AMtrue_INtrue")) {
iCountTestcases++;
strLoc="L_111_4_001.5";
if (!caAmtInt.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_4_8d2p5- caAmtInt.Equals FAiLed!");
}
}
else if (attr.name.Equals ("CA_AMtrue_INtrue2")) {
iCountTestcases++;
strLoc="L_111_4_001.6";
if (!caAmtInt2.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_4_8d2p6- caAmtInt2.Equals FAiLed!");
}
}
}
else {
iCountErrors++;
Util.printerr ("E_111_4_9dus- UnExpected attr type! - " + attrs[i].GetType().ToString ());
}
}
iCountTestcases++;
strLoc="L_111_5_002.2";
attrs = mem.GetCustomAttributes (typeof (ClassLib_Attributes.CA_AMtrue_INfalse), true);
if (attrs == null) {
iCountErrors++;
Util.printerr ("E_111_5_gfh4 - attrs == null");
}
iCountTestcases++;
strLoc="L_111_5_002.3";
if (attrs.Length != iCountAMtrueINfalseAttrs) {
iCountErrors++;
Util.printerr ("E_111_5_jhd3 - attrs.Length != iCountAMtrueINfalseAttrs");
Util.print ("Expected: " + iCountAMtrueINfalseAttrs + ";Returned: " + attrs.Length);
}
iCountTestcases++;
strLoc="L_111_5_002.3.2";
if (!(attrs is ClassLib_Attributes.CA_AMtrue_INfalse[])) {
iCountErrors++;
Util.printerr ("E_111_5_jhd32 - attrs is ClassLib_Attributes.CA_AMtrue_INfalse[] FAiLed!");
}
if (Util.DEBUG > 0) Console.WriteLine("Number of attrs {0}", attrs.Length);
for (int i = 0; i < attrs.Length; i++) {
iCountTestcases++;
strLoc="L_111_5_001.3.2";
if (Util.DEBUG > 1) Console.WriteLine ("{0} : {1}\n\n", i, attrs[i]);
str = attrs[i].ToString ();
iCountTestcases++;
strLoc="L_111_5_001.4";
if (attrs[i] is ClassLib_Attributes.CA_AMtrue_INfalse) {
ClassLib_Attributes.CA_AMtrue_INfalse attr = (ClassLib_Attributes.CA_AMtrue_INfalse) attrs[i];
if (attr.name.Equals ("CA_AMtrue_INfalse")) {
iCountTestcases++;
strLoc="L_111_5_001.5";
if (!caAmtInf.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_5_8d2p5- caAmtInf.Equals FAiLed!");
}
}
else if (attr.name.Equals ("CA_AMtrue_INfalse2")) {
iCountTestcases++;
strLoc="L_111_5_001.5";
if (!caAmtInf2.Equals (attr)) {
iCountErrors++;
Util.printerr ("E_111_5_8d2p5- caAmtInf2.Equals FAiLed!");
}
}
else {
iCountErrors++;
Util.printerr ("E_111_5_djfh - UnExpected attr name! - " + attr.name);
}
}
else {
iCountErrors++;
Util.printerr ("E_111_5_9dus- UnExpected attr type! - " + attrs[i].GetType().ToString ());
}
}
iCountTestcases++;
strLoc="L_111_6_002.2";
attrs = mem.GetCustomAttributes (typeof (System.Attribute), true);
if (attrs == null) {
iCountErrors++;
Util.printerr ("E_111_6_gfh4 - attrs == null");
}
iCountTestcases++;
strLoc="L_111_6_002.3";
if (attrs.Length != (iCountTotalAttrs)) {
iCountErrors++;
Util.printerr ("E_111_6_jhd3 - attrs.Length != iCountTotalAttrs+1");
Util.print ("Expected: " + (iCountTotalAttrs+1) + ";Returned: " + attrs.Length);
}
iCountTestcases++;
strLoc="L_111_6_002.4";
TestAttributes (attrs, mem);
} while ( false );
}
catch( Exception exc_runTest ) {
++iCountErrors;
Util.printerr ("E_111_333un! - Uncaught Exception caught in TestGetCustomAttribute_Type(); strLoc == " + strLoc);
Util.printexc (exc_runTest);
Util.print (exc_runTest.StackTrace);
}
if ( iCountErrors == 0 ) { return true; }
else {
return false;
}
}
}