Ejemplo n.º 1
0
        public async Task InvokeLambda()
        {
            var coordinateObject = await _invoker.InvokeConstructor("uipath.java.test.Coordinate", new List <object> {
                1.5d, 2.3f
            }, null, _ct);

            var coordinate3DObject = await _invoker.InvokeConstructor("uipath.java.testimport.Coordinate3D", new List <object> {
                coordinateObject, 3.1d
            }, null, _ct);

            var lambdaObject = await _invoker.InvokeMethod("GetLambda", "uipath.java.testimport.Coordinate3D", null, null, null, _ct);

            await _invoker.InvokeMethod("ApplyTransform", null, coordinate3DObject, new List <object> {
                lambdaObject, 1, 1, 1
            }, null, _ct);

            var x = await _invoker.InvokeMethod("getX", null, coordinate3DObject, null, null, _ct);

            var y = await _invoker.InvokeMethod("getY", null, coordinate3DObject, null, null, _ct);

            var z = await _invoker.InvokeMethod("getZ", null, coordinate3DObject, null, null, _ct);

            Assert.True(x.Convert <double>() - 2.5d < 0.00001);
            Assert.True(y.Convert <float>() - 3.3f < 0.00001);
            Assert.True(z.Convert <double>() - 4.1d < 0.00001);
        }
        public async Task GenericMethodsConstructor_NoParams()
        {
            var javaObject = await _invoker.InvokeConstructor("uipath.java.test.GenericMethods", null, null, _ct);

            Assert.StartsWith("uipath.java.test.GenericMethods", javaObject.Convert <string>());
        }
        public async Task InvokeCoordinate()
        {
            await _invoker.LoadJar(Path.Combine(JavaTestBaseFixture.JavaFilesPath, "TestProgram.Jar"), _ct);

            var javaObject = await _invoker.InvokeConstructor(
                "uipath.java.test.Coordinate",
                new List <object> {
                3.13d, 3.12f
            },
                null,
                _ct
                );

            var getX = await _invoker.InvokeMethod("getX",
                                                   null,
                                                   javaObject,
                                                   null,
                                                   null,
                                                   _ct
                                                   );

            Assert.True(getX.Convert <double>() - 3.13 < 0.00001);

            await _invoker.LoadJar(Path.Combine(JavaTestBaseFixture.JavaFilesPath, "ImportCoordinate.Jar"), _ct);

            var coordinateObject = await _invoker.InvokeConstructor(
                "uipath.java.test.Coordinate",
                new List <object> {
                1.0d, 2.0f
            },
                null,
                _ct
                );

            var coordinate3DObject = await _invoker.InvokeConstructor(
                "uipath.java.testimport.Coordinate3D",
                new List <object> {
                coordinateObject
            },
                null,
                _ct
                );

            var xCoordinate = await _invoker.InvokeMethod(
                "getX",
                null,
                coordinateObject,
                null,
                null,
                _ct
                );

            var xCoordinate3D = await _invoker.InvokeMethod(
                "getX",
                null,
                coordinate3DObject,
                null,
                null,
                _ct
                );

            var isEqual = await _invoker.InvokeMethod(
                "equals2DCoordinate",
                null,
                coordinate3DObject,
                new List <object> {
                coordinateObject
            },
                null,
                _ct
                );

            Assert.Equal(xCoordinate.Convert <double>(), xCoordinate3D.Convert <double>());
            Assert.Equal(1.0d, xCoordinate3D.Convert <double>());
            Assert.True(isEqual.Convert <bool>());
        }
Ejemplo n.º 4
0
        [TestPriority(0)] // 0-based priority orderer
        public async Task InvokeComplex()
        {
            var javaobject = await _invoker.InvokeConstructor(
                "uipath.java.test.Coordinate",
                new List <object> {
                1.0d, 2.0f
            },
                null,
                _ct
                );

            var javaobject2 = await _invoker.InvokeConstructor(
                "uipath.java.test.Coordinate",
                new List <object> {
                1.3d, 2.4f
            },
                null,
                _ct
                );

            var resultEqaulsCoordinate = await _invoker.InvokeMethod(
                "equalsCoordinate",
                null,
                javaobject,
                new List <object> {
                javaobject2
            },
                null,
                _ct
                );

            Assert.False(resultEqaulsCoordinate.Convert <bool>());

            var instaceCounter = await _invoker.InvokeMethod(
                "getInstanceCounter",
                "uipath.java.test.Coordinate",
                null,
                null,
                null,
                _ct
                );

            Assert.Equal(2, instaceCounter.Convert <int>());

            var getSum = await _invoker.InvokeMethod(
                "getCoordinateSum",
                null,
                javaobject2,
                null,
                null,
                _ct
                );

            Assert.True(Math.Abs(getSum.Convert <double>() - 3.7d) < 0.000001);

            var toString = await _invoker.InvokeMethod(
                "toString",
                null,
                javaobject,
                null,
                null,
                _ct
                );

            Assert.Equal("1.0 2.0", toString.Convert <string>());
        }