Esempio n. 1
0
 public void WithExc()
 {
     WrappedArray<int> wrapped = new WrappedArray<int>(new int[] { 3, 4, 6, 5, 7 });
     //
     try { wrapped.Add(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.AddAll(null); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Clear(); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Dispose(); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     int j = 1;
     try { wrapped.FindOrAdd(ref j); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Insert(1, 1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Insert(wrapped.View(0, 0), 1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.InsertAll(1, null); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.InsertFirst(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.InsertLast(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Remove(); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Remove(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveAll(null); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveAllCopies(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveAt(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveFirst(); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveInterval(0, 0); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RemoveLast(); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.RetainAll(null); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.Update(1, out j); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
     try { wrapped.UpdateOrAdd(1); Assert.Fail("No throw"); }
     catch (FixedSizeCollectionException) { }
 }
Esempio n. 2
0
            public void WithExc()
            {
                WrappedArray <int> wrapped = new WrappedArray <int>(new int[] { 3, 4, 6, 5, 7 });

                //
                try
                {
                    wrapped.Add(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.AddAll <int>(null);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Clear();
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Dispose();
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                int j = 1;

                try
                {
                    wrapped.FindOrAdd(ref j);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Insert(1, 1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Insert(wrapped.View(0, 0), 1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.InsertAll <int>(1, null);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.InsertFirst(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.InsertLast(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Remove();
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Remove(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveAll <int>(null);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveAllCopies(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveAt(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveFirst();
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveInterval(0, 0);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RemoveLast();
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.RetainAll <int>(null);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.Update(1, out j);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
                try
                {
                    wrapped.UpdateOrAdd(1);
                    Assert.Fail("No throw");
                }
                catch (FixedSizeCollectionException) { }
            }