public void ConstructorExceptions()
        {
            Action <string, object []> logger = (f, o) => { };

            // structs aren't supported
            var td = SupportDeclarations.GetTypeDefinition(typeof(int));
            var e  = Assert.Throws <XamarinAndroidException> (() => new JavaCallableWrapperGenerator(td, logger));

            Assert.AreEqual(4200, e.Code);
        }
Ejemplo n.º 2
0
        public void KotlinInvalidHashRegisterName()
        {
            Action <string, object []> logger = (f, o) => { };

            // Contains invalid [Register] name of "foo-f8k2a13"
            var td = SupportDeclarations.GetTypeDefinition(typeof(KotlinInvalidHashRegisterName));
            var e  = Assert.Throws <XamarinAndroidException> (() => new JavaCallableWrapperGenerator(td, logger, cache: null));

            Assert.AreEqual(4217, e.Code);
        }
Ejemplo n.º 3
0
        static string Generate(Type type, string applicationJavaClass = null)
        {
            var td = SupportDeclarations.GetTypeDefinition(type);
            var g  = new JavaCallableWrapperGenerator(td, null)
            {
                ApplicationJavaClass = applicationJavaClass,
            };
            var o = new StringWriter();

            g.Generate("__o");
            g.Generate(o);
            return(o.ToString());
        }
        static string Generate(Type type, string applicationJavaClass = null)
        {
            var td = SupportDeclarations.GetTypeDefinition(type);
            var g  = new JavaCallableWrapperGenerator(td, null)
            {
                ApplicationJavaClass = applicationJavaClass,
            };
            var o   = new StringWriter();
            var dir = Path.GetDirectoryName(typeof(JavaCallableWrapperGeneratorTests).Assembly.Location);

            g.Generate(Path.Combine(dir, "__o"));
            g.Generate(o);
            return(o.ToString());
        }
Ejemplo n.º 5
0
        static string Generate(Type type, string applicationJavaClass = null, string monoRuntimeInit = null)
        {
            var td = SupportDeclarations.GetTypeDefinition(type);
            var g  = new JavaCallableWrapperGenerator(td, log: null, cache: null)
            {
                ApplicationJavaClass      = applicationJavaClass,
                GenerateOnCreateOverrides = true,
                MonoRuntimeInitialization = monoRuntimeInit,
            };
            var o   = new StringWriter();
            var dir = Path.GetDirectoryName(typeof(JavaCallableWrapperGeneratorTests).Assembly.Location);

            g.Generate(Path.Combine(dir, "__o"));
            g.Generate(o);
            return(o.ToString());
        }