How to use Insert method of NUnit.TestUtilities.Collections.SimpleObjectList class

Best Nunit code snippet using NUnit.TestUtilities.Collections.SimpleObjectList.Insert

Run Nunit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

SimpleObjectList.cs

Source: SimpleObjectList.cs Github

copy
1// Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
2
3using System;
4using System.Collections;
5using System.Collections.Generic;
6
7namespace NUnit.TestUtilities.Collections
8{
9    /// <summary>
10    /// SimpleObjectCollection is used in testing to ensure that only
11    /// methods of the ICollection interface are accessible.
12    /// </summary>
13    class SimpleObjectList : IList
14    {
15        private readonly List<object> contents = new List<object>();
16
17        public SimpleObjectList(IEnumerable<object> source)
18        {
19            this.contents = new List<object>(source);
20        }
21
22        public SimpleObjectList(params object[] source)
23        {
24            this.contents = new List<object>(source);
25        }
26
27        #region ICollection Members
28
29        public void CopyTo(Array array, int index)
30        {
31            ((ICollection)contents).CopyTo(array, index);
32        }
33
34        public int Count
35        {
36            get { return contents.Count; }
37        }
38
39        public bool IsSynchronized
40        {
41            get { return  ((ICollection)contents).IsSynchronized; }
42        }
43
44        public object SyncRoot
45        {
46            get { return ((ICollection)contents).SyncRoot; }
47        }
48
49        #endregion
50
51        #region IEnumerable Members
52
53        public IEnumerator GetEnumerator()
54        {
55            return contents.GetEnumerator();
56        }
57
58        #endregion
59
60        #region IList Members
61
62        public int Add(object value)
63        {
64            contents.Add(value);
65            return contents.Count - 1;
66        }
67
68        public void Clear()
69        {
70            contents.Clear();
71        }
72
73        public bool Contains(object value)
74        {
75            return contents.Contains(value);
76        }
77
78        public int IndexOf(object value)
79        {
80            return contents.IndexOf(value);
81        }
82
83        public void Insert(int index, object value)
84        {
85            contents.Insert(index, value);
86        }
87
88        public bool IsFixedSize
89        {
90            get { return false; }
91        }
92
93        public bool IsReadOnly
94        {
95            get { return false; }
96        }
97
98        public void Remove(object value)
99        {
100            contents.Remove(value);
101        }
102
103        public void RemoveAt(int index)
104        {
105            contents.RemoveAt(index);
106        }
107
108        public object this[int index]
109        {
110            get { return contents[index]; }
111            set { contents[index] = value; }
112        }
113
114        #endregion
115    }
116}
117
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Most used method in SimpleObjectList

Trigger Insert code on LambdaTest Cloud Grid

Execute automation tests with Insert on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)