Esempio n. 1
0
        public void ScriptComponentDescriptor_Type()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.Type = "New.Type";
            Assert.AreEqual("New.Type", scd.Type, "Type");
        }
		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);
		}
Esempio n. 3
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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public void ScriptComponentDescriptor_ID()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.ID = null;
            Assert.AreEqual(String.Empty, scd.ID, "#1");
            scd.ID = String.Empty;
            Assert.AreEqual(String.Empty, scd.ID, "#2");
            scd.ID = "My ID";
            Assert.AreEqual("My ID", scd.ID, "#3");
            Assert.AreEqual("My ID", scd.ClientID, "#4");
        }
		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");
		}
Esempio n. 9
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_ID () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.ID = null;
			Assert.AreEqual (String.Empty, scd.ID, "#1");
			scd.ID = String.Empty;
			Assert.AreEqual (String.Empty, scd.ID, "#2");
			scd.ID = "My ID";
			Assert.AreEqual ("My ID", scd.ID, "#3");
			Assert.AreEqual ("My ID", scd.ClientID, "#4");
		}
		public void ScriptComponentDescriptor_Type () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.Type = "New.Type";
			Assert.AreEqual ("New.Type", scd.Type, "Type");
		}
		public void ScriptComponentDescriptor_Type_exception_2 () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.Type = String.Empty;
		}
		public void ScriptComponentDescriptor_Type_exception_1 () {
			PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor ("My.Type");
			scd.Type = null;
		}
		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
		}
Esempio n. 17
0
        public void ScriptComponentDescriptor_Type_exception_1()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.Type = null;
        }
Esempio n. 18
0
        public void ScriptComponentDescriptor_Type_exception_2()
        {
            PokerScriptComponentDescriptor scd = new PokerScriptComponentDescriptor("My.Type");

            scd.Type = String.Empty;
        }