Esempio n. 1
0
		public void RowInsertionAtTheEnd()
		{
			DoubleColumn d = new DoubleColumn(10);
			Assert.AreEqual(0, d.Count);
			Assert.AreEqual(false, d.IsDirty);

			// set rows 0 to 9 to i
			for (int i = 0; i < 10; i++)
				d[i] = i;
			Assert.AreEqual(10, d.Count);

			// testing parent change notification setting the parent
			MyColumnParent parent = new MyColumnParent();
			parent.ChildChanged = new EventHandler(parent.TestParentAddNotification);
			d.ParentObject = parent;
			Assert.AreEqual(1, parent.CallCount, "There was no parent add notification");
			parent.Reset();

			parent.Reset();
			parent.ChildChanged = new EventHandler(parent.ExpectingNotToBeCalledBecauseNoChange);
			// now insert
			d.InsertRows(10, 3);

			// test the data
			Assert.AreEqual(10, d.Count);

			for (int i = 0; i < 10; i++)
				Assert.AreEqual(i, d[i]);

			Assert.AreEqual(double.NaN, d[10]);
		}
Esempio n. 2
0
		public void RowInsertionOneBeforeEnd()
		{
			DoubleColumn d = new DoubleColumn(10);
			Assert.AreEqual(0, d.Count);
			Assert.AreEqual(false, d.IsDirty);

			// set rows 0 to 9 to i
			for (int i = 0; i < 10; i++)
				d[i] = i;
			Assert.AreEqual(10, d.Count);

			// testing parent change notification setting the parent
			MyColumnParent parent = new MyColumnParent();
			parent.ChildChanged = new EventHandler(parent.TestParentAddNotification);
			d.ParentObject = parent;
			Assert.AreEqual(1, parent.CallCount, "There was no parent add notification");
			parent.Reset();

			parent.Reset();
			parent.ChildChanged = new EventHandler(parent.ExpectingDataChange9To12_NoDecrease);
			// now insert
			d.InsertRows(9, 3);
			Assert.AreEqual(1, parent.CallCount, "There was no data change notification");

			// test the data
			Assert.AreEqual(13, d.Count);

			for (int i = 0; i < 9; i++)
				Assert.AreEqual(i, d[i]);

			Assert.AreEqual(double.NaN, d[9]);
			Assert.AreEqual(double.NaN, d[10]);
			Assert.AreEqual(double.NaN, d[11]);

			for (int i = 12; i < 13; i++)
				Assert.AreEqual(i - 3, d[i]);
		}