Exemple #1
0
    public static void StructWithNonBlittableGenericInstantiation_Fails()
    {
        short s = 41;
        char  c = '✅';

        Assert.Throws <MarshalDirectiveException>(() => DisabledRuntimeMarshallingNative.CheckStructWithWCharAndShort(new StructWithShortAndGeneric <char>(s, c), s, c));
    }
Exemple #2
0
    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));
    }
Exemple #3
0
    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));
    }