コード例 #1
0
        public void IndexOf()
        {
            // Arrange
            var lazy = new LazyList <int>(_Int32TestData);

            lazy.Should().NotBeNull();

            // Act & Assert
            lazy.IndexOf(Int32.MinValue).Should().Be(0);
            lazy.IndexOf(-1).Should().Be(1);
            lazy.IndexOf(0).Should().Be(2);
            lazy.IndexOf(1).Should().Be(3);
            lazy.IndexOf(Int32.MaxValue).Should().Be(4);
        }
コード例 #2
0
        public void Insert_RemoveAt()
        {
            // Arrange
            var lazy = new LazyList <int>(_Int32TestData);

            lazy.Should().NotBeNull();
            lazy.Count.Should().Be(5);
            lazy.IsReadOnly.Should().BeFalse();

            lazy.RemoveAt(lazy.IndexOf(0));
            lazy.Count.Should().Be(4);
            lazy.IndexOf(0).Should().Be(-1);

            lazy.Insert(2, 0);
            lazy.Count.Should().Be(5);
            lazy.Should().BeEquivalentTo(_Int32TestData);
        }
コード例 #3
0
ファイル: LazyListTests.cs プロジェクト: tiagor87/lazy-list
        public void GivenLazyListWhenIndexOfShouldLoad()
        {
            var stub = new Stub();

            _lazyLoadResolverMock.Setup(x => x.Resolve(It.IsAny <LazyLoadParameter>()))
            .Returns(new[] { stub })
            .Verifiable();

            var lazyList = new LazyList <Stub>(_lazyLoadResolverMock.Object);

            lazyList.IndexOf(stub).Should().Be(0);
            _lazyLoadResolverMock.VerifyAll();
        }
コード例 #4
0
        public static void Test2()
        {
            Console.WriteLine("Beginning LazyList.GetEnumerator() concurrency test.");
            using var list = new LazyList <TestEntry>(EndlessTest(10000000));
            var sw = new Stopwatch();

            Parallel.ForEach(list, e =>
            {
                if (e is null)
                {
                    throw new NullReferenceException();
                }
            });
            Console.WriteLine(sw.Elapsed);
            Debug.Assert(list.IndexOf(list[10000]) == 10000);
        }
コード例 #5
0
        public static void Test1()
        {
            Console.WriteLine("Beginning LazyList concurrency test.");
            var sw = new Stopwatch();

            using var list = new LazyList <TestEntry>(EndlessTest());
            Parallel.For(0, 10000000, i =>
            {
                // ReSharper disable once AccessToDisposedClosure
                var e = list[i];
                if (e is null)
                {
                    throw new NullReferenceException();
                }
                Debug.Assert(e.Value == i);
            });
            Console.WriteLine(sw.Elapsed);
            Debug.Assert(list.IndexOf(list[10000]) == 10000);
        }
コード例 #6
0
ファイル: LocalList.cs プロジェクト: petterlopes/ConfuserEx
 /// <inheritdoc/>
 public int IndexOf(Local item)
 {
     return(locals.IndexOf(item));
 }
コード例 #7
0
 public int IndexOf(CodedValue item)
 {
     return(m_items.IndexOf(item));
 }
コード例 #8
0
 public int IndexOf(ExerciseSegment item)
 {
     return(m_items.IndexOf(item));
 }
 public int IndexOf(VersionInformation item)
 {
     return(m_items.IndexOf(item));
 }
 public int IndexOf(string item)
 {
     return(m_items.IndexOf(item));
 }
コード例 #11
0
 public int IndexOf(Blob item)
 {
     return(m_items.IndexOf(item));
 }
 public int IndexOf(ItemFilter item)
 {
     return(m_items.IndexOf(item));
 }
コード例 #13
0
 public int IndexOf(StructuredNameValue item)
 {
     return(m_items.IndexOf(item));
 }
コード例 #14
0
 public int IndexOf(object item)
 {
     return(m_items.IndexOf(item));
 }