Example #1
0
        public void WriteInterfaceMethods()
        {
            var iface = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfaceMethods(iface, string.Empty);
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetExpected(nameof(WriteInterfaceMethods)), writer.ToString().NormalizeLineEndings());
        }
Example #2
0
        public void WriteInterfaceListenerProperty()
        {
            var iface = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfaceListenerProperty(iface, string.Empty, "MyName", "MyNameSpec", "MyMethodName", "MyConnectorFmt", "MyFullDelegateName");
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetExpected(nameof(WriteInterfaceListenerProperty)), writer.ToString().NormalizeLineEndings());
        }
Example #3
0
        public void WriteInterfaceListenerEventWithHandlerArgument()
        {
            var iface = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfaceListenerEvent(iface, string.Empty, "MyName", "MyNameSpec", "MyMethodName", "MyFullDelegateName", true, "MyWrefSuffix", "AddMyName", "RemoveMyName", true);
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetExpected(nameof(WriteInterfaceListenerEventWithHandlerArgument)), writer.ToString().NormalizeLineEndings());
        }
Example #4
0
        public void WriteInterfaceDeclaration()
        {
            var iface = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfaceDeclaration(iface, string.Empty, new GenerationInfo(null, null, null));
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetTargetedExpected(nameof(WriteInterfaceDeclaration)), writer.ToString().NormalizeLineEndings());
        }
Example #5
0
        public void WriteInterfacePropertyInvokersWithSkips()
        {
            // This test should skip the first Property because members contains the Property
            var iface   = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);
            var members = new HashSet <string> (new [] { iface.Properties [0].Name });

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfacePropertyInvokers(iface, iface.Properties, string.Empty, members);
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetExpected(nameof(WriteInterfacePropertyInvokersWithSkips)), writer.ToString().NormalizeLineEndings());
        }
Example #6
0
        public void WriteInterfacePropertyInvokers()
        {
            // This test should generate all the properties (members is empty)
            var iface   = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);
            var members = new HashSet <string> ();

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfacePropertyInvokers(iface, iface.Properties, string.Empty, members);
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(GetExpected(nameof(WriteInterfacePropertyInvokers)), writer.ToString().NormalizeLineEndings());
        }
Example #7
0
        public void WriteInterfaceEventHandlerImplContent()
        {
            var iface    = SupportTypeBuilder.CreateInterface("java.code.IMyInterface", options);
            var handlers = new List <string> ();

            generator.Context.ContextTypes.Push(iface);
            generator.WriteInterfaceEventHandlerImplContent(iface, iface.Methods [0], string.Empty, true, string.Empty, handlers);
            generator.Context.ContextTypes.Pop();

            Assert.AreEqual(1, handlers.Count);
            Assert.AreEqual("GetCountForKey", handlers [0]);
            Assert.AreEqual(GetExpected(nameof(WriteInterfaceEventHandlerImplContent)), writer.ToString().NormalizeLineEndings());
        }