Esempio n. 1
0
        public void ForIn()
        {
            var counter  = 0;
            var jsObject = Jsni.@object(new { One = 1, Two = 2 });

            jsObject.forin(x => counter += jsObject[x]);
            QUnit.AreEqual(counter, 3);
        }
Esempio n. 2
0
        public void IndexerOverride()
        {
            Jsni.reference("window").memberset("IndexerOverride", Jsni.@object(new
            {
                items = Jsni.array(),
                item  = Jsni.function((index, value) =>
                {
                    if (Jsni.arguments().As <JsArray>().length == 1)
                    {
                        return(Jsni.@this().member("items").As <JsArray>()[index]);
                    }
                    else
                    {
                        Jsni.@this().member("items").As <JsArray>()[index] = value;
                        return(null);
                    }
                })
            }));
            var indexerOverride = Jsni.reference("window").member("IndexerOverride").As <IndexerOverrideClass>();

            indexerOverride[3] = "foo";
            QUnit.AreEqual(indexerOverride[3], "foo");
        }
Esempio n. 3
0
 public void ExportArray()
 {
     Jsni.reference("window").memberset("ExportTest", Jsni.@object(new { Values = Jsni.array() }));
     ExportTest.Values[0] = Tuple.Create("foo", 1);
     QUnit.IsTrue(ExportTest.Values is Tuple <string, int>[]);
 }