public void CreateKnownTypes_Types()
        {
            var coll = new DataPagerFieldCollectionPoker();

            Assert.AreEqual(typeof(NextPreviousPagerField), coll.DoCreateKnownType(0).GetType(), "#A1");
            Assert.AreEqual(typeof(NumericPagerField), coll.DoCreateKnownType(1).GetType(), "#A2");
            Assert.AreEqual(typeof(TemplatePagerField), coll.DoCreateKnownType(2).GetType(), "#A3");
        }
        public void GetKnownTypes_Test()
        {
            var coll = new DataPagerFieldCollectionPoker();

            Type[] knownTypes = coll.DoGetKnownTypes();

            Assert.AreEqual(3, knownTypes.Length, "#A1");
            Assert.AreEqual(typeof(NextPreviousPagerField), knownTypes [0], "#A2");
            Assert.AreEqual(typeof(NumericPagerField), knownTypes [1], "#A3");
            Assert.AreEqual(typeof(TemplatePagerField), knownTypes [2], "#A4");
        }
        public void DataPagerFieldCollection_Events()
        {
            var events = new EventRecorder();
            var coll   = new DataPagerFieldCollectionPoker(new DataPager(), events);

            coll.CatchFieldsChangedEvent();

            coll.Insert(0, new NextPreviousPagerField());
            Assert.AreEqual(6, events.Count);
            Assert.AreEqual("OnValidate:Enter", events [0], "#A1");
            Assert.AreEqual("OnValidate:Leave", events [1], "#A2");
            Assert.AreEqual("OnInsertComplete:Enter", events [2], "#A3");
            Assert.AreEqual("OnFieldsChanged:Enter", events [3], "#A4");
            Assert.AreEqual("OnFieldsChanged:Leave", events [4], "#A5");
            Assert.AreEqual("OnInsertComplete:Leave", events [5], "#A6");

            events.Clear();
            coll.Clear();
            Assert.AreEqual(4, events.Count);
            Assert.AreEqual("OnClearComplete:Enter", events [0], "#B1");
            Assert.AreEqual("OnFieldsChanged:Enter", events [1], "#B2");
            Assert.AreEqual("OnFieldsChanged:Leave", events [2], "#B3");
            Assert.AreEqual("OnClearComplete:Leave", events [3], "#B4");

            NextPreviousPagerField field = new NextPreviousPagerField();

            coll.Insert(0, field);
            events.Clear();
            coll.Remove(field);
            Assert.AreEqual(8, events.Count);
            Assert.AreEqual("OnValidate:Enter", events [0], "#C1");
            Assert.AreEqual("OnValidate:Leave", events [1], "#C2");
            Assert.AreEqual("OnValidate:Enter", events [2], "#C3");
            Assert.AreEqual("OnValidate:Leave", events [3], "#C4");
            Assert.AreEqual("OnRemoveComplete:Enter", events [4], "#C5");
            Assert.AreEqual("OnFieldsChanged:Enter", events [5], "#C6");
            Assert.AreEqual("OnFieldsChanged:Leave", events [6], "#C7");
            Assert.AreEqual("OnRemoveComplete:Leave", events [7], "#C8");

            coll.Insert(0, field);
            events.Clear();
            coll.RemoveAt(0);

            Assert.AreEqual(4, events.Count);
            Assert.AreEqual("OnRemoveComplete:Enter", events [0], "#D1");
            Assert.AreEqual("OnFieldsChanged:Enter", events [1], "#D2");
            Assert.AreEqual("OnFieldsChanged:Leave", events [2], "#D3");
            Assert.AreEqual("OnRemoveComplete:Leave", events [3], "#D4");
        }
        public void OnValidate_Arguments_NotDataPagerField()
        {
            var coll = new DataPagerFieldCollectionPoker();

            coll.DoOnValidate(String.Empty);
        }
        public void OnValidate_Arguments_Null()
        {
            var coll = new DataPagerFieldCollectionPoker();

            coll.DoOnValidate(null);
        }
        public void CreateKnownTypes_Arguments()
        {
            var coll = new DataPagerFieldCollectionPoker();

            coll.DoCreateKnownType(3);
        }
		public void DataPagerFieldCollection_Events ()
		{
			var events = new EventRecorder ();
			var coll = new DataPagerFieldCollectionPoker (new DataPager (), events);
			coll.CatchFieldsChangedEvent ();
			
			coll.Insert (0, new NextPreviousPagerField ());
			Assert.AreEqual (6, events.Count);
			Assert.AreEqual ("OnValidate:Enter", events [0], "#A1");
			Assert.AreEqual ("OnValidate:Leave", events [1], "#A2");
			Assert.AreEqual ("OnInsertComplete:Enter", events [2], "#A3");
			Assert.AreEqual ("OnFieldsChanged:Enter", events [3], "#A4");
			Assert.AreEqual ("OnFieldsChanged:Leave", events [4], "#A5");
			Assert.AreEqual ("OnInsertComplete:Leave", events [5], "#A6");

			events.Clear ();
			coll.Clear ();
			Assert.AreEqual (4, events.Count);
			Assert.AreEqual ("OnClearComplete:Enter", events [0], "#B1");
			Assert.AreEqual ("OnFieldsChanged:Enter", events [1], "#B2");
			Assert.AreEqual ("OnFieldsChanged:Leave", events [2], "#B3");
			Assert.AreEqual ("OnClearComplete:Leave", events [3], "#B4");

			NextPreviousPagerField field = new NextPreviousPagerField ();
			coll.Insert (0, field);
			events.Clear ();
			coll.Remove (field);
			Assert.AreEqual (8, events.Count);
			Assert.AreEqual ("OnValidate:Enter", events [0], "#C1");
			Assert.AreEqual ("OnValidate:Leave", events [1], "#C2");
			Assert.AreEqual ("OnValidate:Enter", events [2], "#C3");
			Assert.AreEqual ("OnValidate:Leave", events [3], "#C4");
			Assert.AreEqual ("OnRemoveComplete:Enter", events [4], "#C5");
			Assert.AreEqual ("OnFieldsChanged:Enter", events [5], "#C6");
			Assert.AreEqual ("OnFieldsChanged:Leave", events [6], "#C7");
			Assert.AreEqual ("OnRemoveComplete:Leave", events [7], "#C8");

			coll.Insert (0, field);
			events.Clear ();
			coll.RemoveAt (0);

			Assert.AreEqual (4, events.Count);
			Assert.AreEqual ("OnRemoveComplete:Enter", events [0], "#D1");
			Assert.AreEqual ("OnFieldsChanged:Enter", events [1], "#D2");
			Assert.AreEqual ("OnFieldsChanged:Leave", events [2], "#D3");
			Assert.AreEqual ("OnRemoveComplete:Leave", events [3], "#D4");
		}
		public void OnValidate_Arguments_NotDataPagerField ()
		{
			var coll = new DataPagerFieldCollectionPoker ();
			coll.DoOnValidate (String.Empty);
		}
		public void OnValidate_Arguments_Null ()
		{
			var coll = new DataPagerFieldCollectionPoker ();
			coll.DoOnValidate (null);
		}
Esempio n. 10
0
		public void CreateKnownTypes_Arguments ()
		{
			var coll = new DataPagerFieldCollectionPoker ();
			coll.DoCreateKnownType (3);
		}
Esempio n. 11
0
		public void CreateKnownTypes_Types ()
		{
			var coll = new DataPagerFieldCollectionPoker ();

			Assert.AreEqual (typeof (NextPreviousPagerField), coll.DoCreateKnownType (0).GetType (), "#A1");
			Assert.AreEqual (typeof (NumericPagerField), coll.DoCreateKnownType (1).GetType (), "#A2");
			Assert.AreEqual (typeof (TemplatePagerField), coll.DoCreateKnownType (2).GetType (), "#A3");
		}
Esempio n. 12
0
		public void GetKnownTypes_Test ()
		{
			var coll = new DataPagerFieldCollectionPoker ();
			Type[] knownTypes = coll.DoGetKnownTypes ();

			Assert.AreEqual (3, knownTypes.Length, "#A1");
			Assert.AreEqual (typeof (NextPreviousPagerField), knownTypes [0], "#A2");
			Assert.AreEqual (typeof (NumericPagerField), knownTypes [1], "#A3");
			Assert.AreEqual (typeof (TemplatePagerField), knownTypes [2], "#A4");
		}