public void GetEndComSlot_NotRuntimeType_ThrowsArgumentException()
        {
            AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName("Assembly"), AssemblyBuilderAccess.Run);
            ModuleBuilder   moduleBuilder   = assemblyBuilder.DefineDynamicModule("Module");
            TypeBuilder     typeBuilder     = moduleBuilder.DefineType("Type");

            AssertExtensions.Throws <ArgumentException>("t", () => Marshal.GetEndComSlot(typeBuilder));
        }
Exemple #2
0
            static KnownMethodSlots()
            {
                var iface     = typeof(ID3DXEffect);
                var firstSlot = Marshal.GetStartComSlot(iface);
                var lastSlot  = Marshal.GetEndComSlot(iface);

                for (var i = firstSlot; i <= lastSlot; i++)
                {
                    ComMemberType mt          = ComMemberType.Method;
                    var           mi          = Marshal.GetMethodInfoForComSlot(iface, i, ref mt);
                    var           targetField = typeof(KnownMethodSlots).GetField(mi.Name);
                    if (targetField == null)
                    {
                        continue;
                    }
                    targetField.SetValue(null, (uint)i);
                }
            }
 public void GetEndComSlot_Windows_ReturnsExpected(Type type, int expected)
 {
     Assert.Equal(expected, Marshal.GetEndComSlot(type));
 }
 public void GetEndComSlot_InvalidGenericType_ThrowsArgumentNullException(Type type)
 {
     AssertExtensions.Throws <ArgumentNullException>(null, () => Marshal.GetEndComSlot(type));
 }
 public void GetEndComSlot_NullType_ThrowsArgumentNullException()
 {
     AssertExtensions.Throws <ArgumentNullException>(null, () => Marshal.GetEndComSlot(null));
 }
 public void GetEndComSlot_Unix_ThrowsPlatformNotSupportedException()
 {
     Assert.Throws <PlatformNotSupportedException>(() => Marshal.GetEndComSlot(null));
 }
 public void GetEndComSlot_NotComVisibleType_ThrowsArgumentException(Type type)
 {
     AssertExtensions.Throws <ArgumentException>("t", () => Marshal.GetEndComSlot(type));
 }