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); }
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); }
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(); }
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); }
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); }
/// <inheritdoc/> public int IndexOf(Local item) { return(locals.IndexOf(item)); }
public int IndexOf(CodedValue item) { return(m_items.IndexOf(item)); }
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)); }
public int IndexOf(Blob item) { return(m_items.IndexOf(item)); }
public int IndexOf(ItemFilter item) { return(m_items.IndexOf(item)); }
public int IndexOf(StructuredNameValue item) { return(m_items.IndexOf(item)); }
public int IndexOf(object item) { return(m_items.IndexOf(item)); }