Пример #1
0
        public void IList_NotSupported()
        {
            var array = new long[] { 1, 2, 3, 4, 5, 6, -10 };

            IList <long> s = new ArraySegment <long> (array, 2, 3);

            try {
                s.Add(1);
                Assert.Fail("#1");
            } catch (NotSupportedException) {
            }

            try {
                s.Clear();
                Assert.Fail("#2");
            } catch (NotSupportedException) {
            }

            try {
                s.Remove(3);
                Assert.Fail("#3");
            } catch (NotSupportedException) {
            }

            try {
                s.RemoveAt(3);
                Assert.Fail("#4");
            } catch (NotSupportedException) {
            }

            try {
                s.Insert(2, 3);
                Assert.Fail("#5");
            } catch (NotSupportedException) {
            }
        }
Пример #2
0
		public void IList_NotSupported ()
		{
			var array = new long[] { 1, 2, 3, 4, 5, 6, -10 };

			IList<long> s = new ArraySegment<long> (array, 2, 3);

			try {
				s.Add (1);
				Assert.Fail ("#1");
			} catch (NotSupportedException) {
			}

			try {
				s.Clear ();
				Assert.Fail ("#2");
			} catch (NotSupportedException) {
			}

			try {
				s.Remove (3);
				Assert.Fail ("#3");
			} catch (NotSupportedException) {
			}

			try {
				s.RemoveAt (3);
				Assert.Fail ("#4");
			} catch (NotSupportedException) {
			}

			try {
				s.Insert (2, 3);
				Assert.Fail ("#5");
			} catch (NotSupportedException) {
			}
		}