Пример #1
0
        public void SealedListContainsTest()
        {
            tlog.Debug(tag, $"SealedListContainsTest START");
            try
            {
                var sl = new SealedList <int>();
                Assert.IsNotNull(sl, "null SealedList");
                sl.Add(1);
                var ret = sl.Contains(1);
                Assert.AreEqual(true, ret, "Should be equal");

                int[] ia = new int[] { 1, 2, 3 };
                sl.CopyTo(ia, 0);

                var ret2 = sl.GetEnumerator();
                var ret3 = sl.IndexOf(1);
                sl.Insert(0, 2);
                var ret4 = sl[1];
                sl.Remove(1);

                sl.Insert(0, 3);
                sl.RemoveAt(0);
            }
            catch (Exception e)
            {
                Assert.Fail("Caught Exception" + e.ToString());
            }
            tlog.Debug(tag, $"SealedListContainsTest END");
        }
Пример #2
0
        public void SealedListAddTest2()
        {
            tlog.Debug(tag, $"SealedListAddTest2 START");
            var sl = new SealedList <int>();

            Assert.IsNotNull(sl, "null SealedList");
            sl.IsReadOnly = true;
            Assert.Throws <InvalidOperationException>(() => sl.Add(1));

            tlog.Debug(tag, $"SealedListAddTest2 END");
        }
Пример #3
0
 public void SealedListAddTest()
 {
     tlog.Debug(tag, $"SealedListAddTest START");
     try
     {
         var sl = new SealedList <int>();
         Assert.IsNotNull(sl, "null SealedList");
         sl.Add(1);
     }
     catch (Exception e)
     {
         Assert.Fail("Caught Exception" + e.ToString());
     }
     tlog.Debug(tag, $"SealedListAddTest END");
 }
Пример #4
0
        public void SealedListThisTest()
        {
            tlog.Debug(tag, $"SealedListThisTest START");

            var sl = new SealedList <int>();

            Assert.IsNotNull(sl, "null SealedList");
            sl.Add(1);
            sl[0]         = 2;
            sl.IsReadOnly = true;
            var i = sl[0];

            Assert.Throws <InvalidOperationException>(() => sl[0] = 2);

            tlog.Debug(tag, $"SealedListThisTest END");
        }
Пример #5
0
        public void Contains()
        {
            tlog.Debug(tag, $"Contains START");

            var sl = new SealedList <int>();

            Assert.IsNotNull(sl, "null SealedList");
            sl.Add(1);
            var ret = sl.Contains(1);

            Assert.AreEqual(true, ret, "Should be equal");
            var ret2 = sl.IndexOf(1);

            Assert.AreEqual(0, ret2, "Should be equal");
            sl.Remove(1);
            sl.CopyTo(new int[1] {
                3
            }, 0);
            tlog.Debug(tag, $"IsReadOnly END");
        }