Esempio n. 1
0
        public void InsertRange_Past_End_Should_Throw_Exception()
        {
            var target = new PerspexList <int>();

            Assert.Throws <ArgumentOutOfRangeException>(() => target.InsertRange(1, new List <int>()
            {
                1
            }));
        }
Esempio n. 2
0
        public void Inserting_Items_Should_Raise_CollectionChanged()
        {
            var target = new PerspexList <int>(new[] { 1, 2 });
            var raised = false;

            target.CollectionChanged += (s, e) =>
            {
                Assert.Equal(target, s);
                Assert.Equal(NotifyCollectionChangedAction.Add, e.Action);
                Assert.Equal(new[] { 3, 4 }, e.NewItems.Cast <int>());
                Assert.Equal(1, e.NewStartingIndex);

                raised = true;
            };

            target.InsertRange(1, new[] { 3, 4 });

            Assert.True(raised);
        }
Esempio n. 3
0
        public void InsertRange_With_Null_Should_Throw_Exception()
        {
            var target = new PerspexList <int>();

            Assert.Throws <ArgumentNullException>(() => target.InsertRange(1, null));
        }
Esempio n. 4
0
        public void InsertRange_Past_End_Should_Throw_Exception()
        {
            var target = new PerspexList<int>();

            Assert.Throws<ArgumentOutOfRangeException>(() => target.InsertRange(1, new List<int>() { 1 }));
        }
Esempio n. 5
0
        public void InsertRange_With_Null_Should_Throw_Exception()
        {
            var target = new PerspexList<int>();

            Assert.Throws<ArgumentNullException>(() => target.InsertRange(1, null));
        }
Esempio n. 6
0
        public void Inserting_Items_Should_Raise_CollectionChanged()
        {
            var target = new PerspexList<int>(new[] { 1, 2 });
            var raised = false;

            target.CollectionChanged += (s, e) =>
            {
                Assert.Equal(target, s);
                Assert.Equal(NotifyCollectionChangedAction.Add, e.Action);
                Assert.Equal(new[] { 3, 4 }, e.NewItems.Cast<int>());
                Assert.Equal(1, e.NewStartingIndex);

                raised = true;
            };

            target.InsertRange(1, new[] { 3, 4 });

            Assert.True(raised);
        }