示例#1
0
        public static IEnumerable <object?[]> CodeSnippetsToFail()
        {
            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler <long>(), new string[] {
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Import1'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of the return value of method 'Export1'.",
                                         }, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler <object>(), null, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Func<string>"), null, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Action"), new string[] {
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Import1'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of the return value of method 'Export1'.",
                                         }, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Span<byte>"), null, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler("System.Span<long>"), null, null });

            yield return(new object?[] { CodeSnippets.DefaultReturnMarshaler("System.ArraySegment<byte>"), null, null });

            yield return(new object?[] { CodeSnippets.AllMissing, new string[] {
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object. The generated source will not handle marshalling of parameter 'a1'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a2'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of long. The generated source will not handle marshalling of parameter 'a3'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Action. The generated source will not handle marshalling of parameter 'a4'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Func<int>. The generated source will not handle marshalling of parameter 'a5'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Span<byte>. The generated source will not handle marshalling of parameter 'a6'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.ArraySegment<byte>. The generated source will not handle marshalling of parameter 'a7'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<object>. The generated source will not handle marshalling of parameter 'a8'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of object[]. The generated source will not handle marshalling of parameter 'a9'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTime. The generated source will not handle marshalling of parameter 'a10'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.DateTimeOffset. The generated source will not handle marshalling of parameter 'a11'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTime>. The generated source will not handle marshalling of parameter 'a12'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<global::System.DateTimeOffset>. The generated source will not handle marshalling of parameter 'a13'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a14'.",
                                             "Please annotate the argument with 'JSMarshalAsAttribute' to specify marshaling of global::System.Threading.Tasks.Task<long>. The generated source will not handle marshalling of parameter 'a15'.",
                                         }, null });

            yield return(new object?[] { CodeSnippets.InOutRef, new string[] {
                                             "Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a1'.",
                                             "Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a2'.",
                                             "Parameters with 'in', 'out' and 'ref' modifiers are not supported by source-generated JavaScript interop. The generated source will not handle marshalling of parameter 'a3'.",
                                         }, null });
        }
示例#2
0
        public static IEnumerable <object[]> CodeSnippetsToCompile()
        {
            yield return(new object[] { CodeSnippets.TrivialClassDeclarations });

            yield return(new object[] { CodeSnippets.AllDefault });

            yield return(new object[] { CodeSnippets.AllAnnotated });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <int>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <byte>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <bool>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <char>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <string>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <JSObject>() });

            yield return(new object[] { CodeSnippets.DefaultReturnMarshaler <Exception>() });
        }