public void ScriptComponentDescriptor_Defaults ()
		{
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");

			Assert.AreEqual ("My.Type", scd.Type, "Type");
			Assert.AreEqual (String.Empty, scd.ID, "ID");
			Assert.AreEqual (String.Empty, scd.ClientID, "ClientID");

			string script = scd.DoGetScript ();
			Assert.AreEqual ("$create(My.Type, null, null, null);", script, "#A1");

			scd.ID = "SomeID";
			script = scd.DoGetScript ();
			Assert.AreEqual ("$create(My.Type, {\"id\":\"SomeID\"}, null, null);", script, "#A2");
		}
示例#2
0
        public void ScriptComponentDescriptor_Defaults()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            Assert.AreEqual("My.Type", scd.Type, "Type");
            Assert.AreEqual(String.Empty, scd.ID, "ID");
            Assert.AreEqual(String.Empty, scd.ClientID, "ClientID");

            string script = scd.DoGetScript();

            Assert.AreEqual("$create(My.Type, null, null, null);", script, "#A1");

            scd.ID = "SomeID";
            script = scd.DoGetScript();
            Assert.AreEqual("$create(My.Type, {\"id\":\"SomeID\"}, null, null);", script, "#A2");
        }
		public void ScriptComponentDescriptor_AddComponentProperty () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.AddComponentProperty ("myName1", "myCompId1");
			scd.AddComponentProperty ("myName2", "myCompId2");

			string script = scd.DoGetScript ();
			Assert.AreEqual ("$create(My.Type, null, null, {\"myName1\":\"myCompId1\",\"myName2\":\"myCompId2\"});", script);
		}
示例#4
0
        public void ScriptComponentDescriptor_AddComponentProperty()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.AddComponentProperty("myName1", "myCompId1");
            scd.AddComponentProperty("myName2", "myCompId2");

            string script = scd.DoGetScript();

            Assert.AreEqual("$create(My.Type, null, null, {\"myName1\":\"myCompId1\",\"myName2\":\"myCompId2\"});", script);
        }
示例#5
0
        public void ScriptComponentDescriptor_AddEvent()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.AddEvent("myName1", "myHandler1");
            scd.AddEvent("myName2", "myHandler2");

            string script = scd.DoGetScript();

            Assert.AreEqual("$create(My.Type, null, {\"myName1\":myHandler1,\"myName2\":myHandler2}, null);", script);
        }
示例#6
0
        public void ScriptComponentDescriptor_AddProperty_Null()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.AddProperty("myName1", null);
            scd.AddProperty("myName2", null);

            string script = scd.DoGetScript();

            Assert.AreEqual("$create(My.Type, {\"myName1\":null,\"myName2\":null}, null, null);", script);
        }
示例#7
0
        public void ScriptComponentDescriptor_AddScriptProperty()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.AddScriptProperty("myName1", "myScript1");
            scd.AddScriptProperty("myName2", "myScript2");

            string script = scd.DoGetScript();

#if TARGET_JVM
            Assert.AreEqual("$create(My.Type, {\"myName2\":myScript2,\"myName1\":myScript1}, null, null);", script);
#else
            Assert.AreEqual("$create(My.Type, {\"myName1\":myScript1,\"myName2\":myScript2}, null, null);", script);
#endif
        }
		public void ScriptComponentDescriptor_AddElementProperty () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.AddElementProperty ("myName1", "myElemId1");
			scd.AddElementProperty ("myName2", "myElemId2");

			string script = scd.DoGetScript ();
#if TARGET_JVM
			Assert.AreEqual ("$create(My.Type, {\"myName2\":$get(\"myElemId2\"),\"myName1\":$get(\"myElemId1\")}, null, null);", script);
#else
			Assert.AreEqual ("$create(My.Type, {\"myName1\":$get(\"myElemId1\"),\"myName2\":$get(\"myElemId2\")}, null, null);", script);
#endif
		}
		public void ScriptComponentDescriptor_AddEvent () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.AddEvent ("myName1", "myHandler1");
			scd.AddEvent ("myName2", "myHandler2");

			string script = scd.DoGetScript ();
#if TARGET_JVM
			Assert.AreEqual ("$create(My.Type, null, {\"myName2\":myHandler2,\"myName1\":myHandler1}, null);", script);
#else
			Assert.AreEqual ("$create(My.Type, null, {\"myName1\":myHandler1,\"myName2\":myHandler2}, null);", script);
#endif
		}
		public void ScriptComponentDescriptor_AddProperty_Null () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.AddProperty ("myName1", null);
			scd.AddProperty ("myName2", null);

			string script = scd.DoGetScript ();
#if TARGET_JVM
			Assert.AreEqual ("$create(My.Type, {\"myName2\":null,\"myName1\":null}, null, null);", script);
#else
			Assert.AreEqual ("$create(My.Type, {\"myName1\":null,\"myName2\":null}, null, null);", script);
#endif
		}