public void Test_List()
        {
            Test(() =>
            {
                var ibridgeresult = _ConverTOJSO.Map(_Tests).Result;
                ibridgeresult.Type.Should().Be(JsCsGlueType.Array);
                IJavascriptObject resv = ibridgeresult.JSValue;

                resv.Should().NotBeNull();
                resv.IsArray.Should().BeTrue();
                resv.GetArrayLength().Should().Be(2);

                IJavascriptObject res = resv.GetValue(0);
                res.Should().NotBeNull();
                var res1 = res.GetValue("S1");
                res1.Should().NotBeNull();
                res1.IsString.Should().BeTrue();

                var jsv = res.GetValue("S1");
                jsv.Should().NotBeNull();
                jsv.IsString.Should().BeTrue();
                string stv = jsv.GetStringValue();
                stv.Should().NotBeNull();
                stv.Should().Be("string1");

                var res2 = res.GetValue("I1");
                res2.Should().NotBeNull();
                res2.IsNumber.Should().BeTrue();
                int v2 = res2.GetIntValue();
                v2.Should().Be(1);
            });
        }
 public void ClearAllCollection(IJavascriptObject array)
 {
     _WebView.RunAsync(() =>
     {
         var length = array.GetArrayLength();
         array.Invoke("silentSplice", _WebView, _WebView.Factory.CreateInt(0), _WebView.Factory.CreateInt(length));
     });
 }
 public void ClearAllCollection(IJavascriptObject array)
 {
     _WebView.RunAsync(() =>
     {
         var length = array.GetArrayLength();
         array.Invoke("silentSplice", _WebView, _WebView.Factory.CreateInt(0), _WebView.Factory.CreateInt(length));
     });
 }
Esempio n. 4
0
        private static void CheckDecimalCollection(IJavascriptObject coll, IList <decimal> skill)
        {
            coll.GetArrayLength().Should().Be(skill.Count);

            for (var i = 0; i < skill.Count; i++)
            {
                var c = (decimal)coll.GetValue(i).GetDoubleValue();
                c.Should().Be(skill[i]);
            }
        }
Esempio n. 5
0
        protected void CheckCollection(IJavascriptObject coll, IList <Skill> skill)
        {
            coll.GetArrayLength().Should().Be(skill.Count);

            for (var i = 0; i < skill.Count; i++)
            {
                var c = coll.GetValue(i);

                (GetSafe(() => GetStringAttribute(c, "Name"))).Should().Be(skill[i].Name);
                (GetSafe(() => GetStringAttribute(c, "Type"))).Should().Be(skill[i].Type);
            }
        }
        protected void Check(IJavascriptObject coll, IList<Skill> iskill) 
        {
            coll.GetArrayLength().Should().Be(iskill.Count);

            for (int i = 0; i < iskill.Count; i++) 
            {
                var c = coll.GetValue(i);

                (GetSafe(() => GetStringAttribute(c, "Name"))).Should().Be(iskill[i].Name);
                (GetSafe(() => GetStringAttribute(c, "Type"))).Should().Be(iskill[i].Type);
            }
        }
        public async Task Test_List()
        {
            await TestAsync(async() =>
            {
                var ibridgeresult = await Map(_Tests);

                DoSafe(() =>
                {
                    ibridgeresult.Type.Should().Be(JsCsGlueType.Array);
                    IJavascriptObject resv = ibridgeresult.JSValue;

                    resv.Should().NotBeNull();
                    resv.IsArray.Should().BeTrue();
                    resv.GetArrayLength().Should().Be(2);

                    IJavascriptObject res = resv.GetValue(0);
                    res.Should().NotBeNull();
                    var res1 = res.GetValue("S1");
                    res1.Should().NotBeNull();
                    res1.IsString.Should().BeTrue();

                    var jsv = res.GetValue("S1");
                    jsv.Should().NotBeNull();
                    jsv.IsString.Should().BeTrue();
                    string stv = jsv.GetStringValue();
                    stv.Should().NotBeNull();
                    stv.Should().Be("string1");

                    var res2 = res.GetValue("I1");
                    res2.Should().NotBeNull();
                    res2.IsNumber.Should().BeTrue();
                    int v2 = res2.GetIntValue();
                    v2.Should().Be(1);
                });
            });
        }
Esempio n. 8
0
        private static void CheckIntCollection(IJavascriptObject actual, IEnumerable <int> expected)
        {
            var javaCollection = Enumerable.Range(0, actual.GetArrayLength()).Select(i => actual.GetValue(i).GetIntValue());

            javaCollection.Should().Equal(expected);
        }
        private static void Checkstring(IJavascriptObject coll, IEnumerable <string> iskill)
        {
            var javaCollection = Enumerable.Range(0, coll.GetArrayLength()).Select(i => coll.GetValue(i).GetStringValue());

            javaCollection.Should().Equal(iskill);
        }