Exemple #1
0
        public static void InvalidListOperations()
        {
            var array = new SqlArray(new SqlExpression[0]);
            var list  = array as IList;

            Assert.True(list.IsFixedSize);
            Assert.False(list.IsSynchronized);
            Assert.True(list.IsReadOnly);
            Assert.Equal(array.Length, list.Count);

            var dummy = SqlExpression.Constant(SqlObject.Bit(false));

            Assert.Throws <NotSupportedException>(() => list.Add(dummy));
            Assert.Throws <NotSupportedException>(() => list.Contains(dummy));
            Assert.Throws <NotSupportedException>(() => list.IndexOf(dummy));
            Assert.Throws <NotSupportedException>(() => list[0] = dummy);
            Assert.Throws <NotSupportedException>(() => list.Clear());
            Assert.Throws <NotSupportedException>(() => list.Remove(dummy));
            Assert.Throws <NotSupportedException>(() => list.RemoveAt(0));
            Assert.Throws <NotSupportedException>(() => list.Insert(2, dummy));
        }