Esempio n. 1
0
        public void MoveThrowsArgumentOutOfRangeException()
        {
            var c = new SynchronizedNotifyingCollection <int>();

            c.Add(1);
            c.Add(2);
            c.Add(3);
            c.Add(4);
            c.Add(5);

            Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(-1, 1));
            Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(5, 1));
            Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(1, -1));
            Assert.Throws <ArgumentOutOfRangeException>(() => c.Move(-1, 5));
        }
        public void MoveTest()
        {
            var c = new SynchronizedNotifyingCollection<int>();
              c.Add(1);
              c.Add(2);
              c.Add(3);
              c.Add(4);
              c.Add(5);

              c.CollectionChanged += OnMove;

              c.Move(0, 0);   // Ok, does nothing.
              c.Move(1, 4);

              Assert.AreEqual(1, c[0]);
              Assert.AreEqual(3, c[1]);
              Assert.AreEqual(4, c[2]);
              Assert.AreEqual(5, c[3]);
              Assert.AreEqual(2, c[4]);

              Assert.AreEqual(5, c.Count);
        }
Esempio n. 3
0
        public void MoveTest()
        {
            var c = new SynchronizedNotifyingCollection <int>();

            c.Add(1);
            c.Add(2);
            c.Add(3);
            c.Add(4);
            c.Add(5);

            c.CollectionChanged += OnMove;

            c.Move(0, 0); // Ok, does nothing.
            c.Move(1, 4);

            Assert.AreEqual(1, c[0]);
            Assert.AreEqual(3, c[1]);
            Assert.AreEqual(4, c[2]);
            Assert.AreEqual(5, c[3]);
            Assert.AreEqual(2, c[4]);

            Assert.AreEqual(5, c.Count);
        }
        public void MoveThrowsArgumentOutOfRangeException()
        {
            var c = new SynchronizedNotifyingCollection<int>();
              c.Add(1);
              c.Add(2);
              c.Add(3);
              c.Add(4);
              c.Add(5);

              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(5, 1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(1, -1));
              Assert.Throws<ArgumentOutOfRangeException>(() => c.Move(-1, 5));
        }