コード例 #1
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]);
            }
        }
コード例 #2
0
ファイル: DoubleColumn_Test.cs プロジェクト: olesar/Altaxo
        public void RowInsertionInTheMiddle()
        {
            var 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
            var 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.ExpectingDataChange5To12_NoDecrease);
            // now insert
            d.InsertRows(5, 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 < 5; i++)
            {
                Assert.AreEqual(i, d[i]);
            }

            Assert.AreEqual(double.NaN, d[5]);
            Assert.AreEqual(double.NaN, d[6]);
            Assert.AreEqual(double.NaN, d[7]);

            for (int i = 8; i < (8 + 5); i++)
            {
                Assert.AreEqual(i - 3, d[i]);
            }
        }
コード例 #3
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]);
        }