Esempio n. 1
0
        public void Clear()
        {
            using (var arr = new SwiftArray <float> (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
                arr.Clear();
                Assert.AreEqual(0, arr.Count, "Count 1");
                arr.Add(1);
                Assert.AreEqual(1, arr.Count, "Count 2");
                arr.Clear();
                Assert.AreEqual(0, arr.Count, "Count 3");

                arr.Dispose();
                Assert.Throws <ObjectDisposedException> (() => arr.Clear(), "Clear ODE");
            }
        }
Esempio n. 2
0
        public void Contains()
        {
            using (var arr = new SwiftArray <ulong> (1, 2, 3, 4, 5, 6, 7, 8, 9)) {
                Assert.IsTrue(arr.Contains(8), "Contains 1");
                Assert.IsFalse(arr.Contains(10), "Contains 2");
                arr.Clear();
                Assert.IsFalse(arr.Contains(8), "Contains 3");
                Assert.IsFalse(arr.Contains(10), "Contains 4");
                arr.Add(10);
                Assert.IsFalse(arr.Contains(8), "Contains 5");
                Assert.IsTrue(arr.Contains(10), "Contains 6");

                arr.Dispose();
                Assert.Throws <ObjectDisposedException> (() => arr.Contains(3), "Contains ODE");
            }
        }