public static void StructWithNonBlittableGenericInstantiation_Fails() { short s = 41; char c = '✅'; Assert.Throws <MarshalDirectiveException>(() => DisabledRuntimeMarshallingNative.CheckStructWithWCharAndShort(new StructWithShortAndGeneric <char>(s, c), s, c)); }
public static void StructWithBlittableGenericInstantiation() { short s = 42; // We use a the "green check mark" character so that we use both bytes and // have a value that can't be accidentally round-tripped. char c = '✅'; Assert.True(DisabledRuntimeMarshallingNative.CheckStructWithWCharAndShort(new StructWithShortAndGeneric <short>(s, (short)c), s, (short)c)); }
public static void StructWithDefaultNonBlittableFields_Char_MarshalAsInfo() { short s = 41; // We use a the "green check mark" character so that we use both bytes and // have a value that can't be accidentally round-tripped. char c = '✅'; Assert.False(DisabledRuntimeMarshallingNative.CheckStructWithWCharAndShort(new StructWithWCharAndShortWithMarshalAs(s, c), s, c)); }