/// <summary> ///runs all tests involving pinvoke signatures passing/returning structures ///containing SH fields with invalid MarshalAs attributes /// </summary> public static void RunSHFldInvalidMATests() { Console.WriteLine("\nRunSHFldInvalidMATests():"); StructMA1 s1 = new StructMA1(); s1.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA1..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s1), "FAILED! Exception not thrown."); StructMA2 s2 = new StructMA2(); s2.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA2..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s2), "FAILED! Exception not thrown."); StructMA3 s3 = new StructMA3(); s3.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA3..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s3), "FAILED! Exception not thrown."); StructMA4 s4 = new StructMA4(); s4.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA4..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s4), "FAILED! Exception not thrown."); StructMA5 s5 = new StructMA5(); s5.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA5..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s5), "FAILED! Exception not thrown."); StructMA6 s6 = new StructMA6(); s6.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA6..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s6), "FAILED! Exception not thrown."); StructMA7 s7 = new StructMA7(); s7.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA7..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s7), "FAILED! Exception not thrown."); /* * StructMA8 s8 = new StructMA8(); * s5.hnd = Helper.NewSFH(); * Console.WriteLine("Testing StructMA8..."); * Assert.Throws<TypeLoadException>(() => SHFldInvalid_MA(s8), "FAILED! Exception not thrown."); */ StructMA9 s9 = new StructMA9(); s9.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA9..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s9), "FAILED! Exception not thrown."); StructMA10 s10 = new StructMA10(); s10.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA10..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s10), "FAILED! Exception not thrown."); StructMA11 s11 = new StructMA11(); s11.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA11..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s11), "FAILED! Exception not thrown."); StructMA12 s12 = new StructMA12(); s12.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA12..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s12), "FAILED! Exception not thrown."); StructMA13 s13 = new StructMA13(); s13.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA13..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s13), "FAILED! Exception not thrown."); StructMA14 s14 = new StructMA14(); s14.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA14..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s14), "FAILED! Exception not thrown."); StructMA15 s15 = new StructMA15(); s15.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA15..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s15), "FAILED! Exception not thrown."); //NOTE: UnmanagedType.Interface is the only MA attribute allowed /* * StructMA16 s16 = new StructMA16(); * s16.hnd = Helper.NewSFH(); * Console.WriteLine("Testing StructMA16..."); * Assert.Throws<TypeLoadException>(() => SHFldInvalid_MA(s16), "FAILED! Exception not thrown."); */ StructMA17 s17 = new StructMA17(); s17.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA17..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s17), "FAILED! Exception not thrown."); StructMA18 s18 = new StructMA18(); s18.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA18..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s18), "FAILED! Exception not thrown."); StructMA19 s19 = new StructMA19(); s19.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA19..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s19), "FAILED! Exception not thrown."); StructMA20 s20 = new StructMA20(); s20.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA20..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s20), "FAILED! Exception not thrown."); StructMA21 s21 = new StructMA21(); s21.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA21..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s21), "FAILED! Exception not thrown."); StructMA22 s22 = new StructMA22(); s22.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA22..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s22), "FAILED! Exception not thrown."); StructMA23 s23 = new StructMA23(); s23.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA23..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s23), "FAILED! Exception not thrown."); StructMA24 s24 = new StructMA24(); s24.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA24..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s24), "FAILED! Exception not thrown."); StructMA25 s25 = new StructMA25(); s25.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA25..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s25), "FAILED! Exception not thrown."); StructMA26 s26 = new StructMA26(); s26.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA26..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s26), "FAILED! Exception not thrown."); StructMA27 s27 = new StructMA27(); s27.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA27..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s27), "FAILED! Exception not thrown."); StructMA28 s28 = new StructMA28(); s28.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA28..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s28), "FAILED! Exception not thrown."); StructMA29 s29 = new StructMA29(); s29.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA29..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s29), "FAILED! Exception not thrown."); StructMA30 s30 = new StructMA30(); s30.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA30..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s30), "FAILED! Exception not thrown."); StructMA31 s31 = new StructMA31(); s31.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA31..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s31), "FAILED! Exception not thrown."); StructMA32 s32 = new StructMA32(); s32.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA32..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s32), "FAILED! Exception not thrown."); StructMA33 s33 = new StructMA33(); s33.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA33..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s33), "FAILED! Exception not thrown."); StructMA34 s34 = new StructMA34(); s34.hnd = Helper.NewSFH(); Console.WriteLine("Testing StructMA34..."); Assert.Throws <TypeLoadException>(() => SHFldInvalid_MA(s34), "FAILED! Exception not thrown."); }
public static extern bool SHFldInvalid_MA(StructMA28 s);