public void ElementAtOrDefaultNonEmptyListSource() { ListData <int> data = ListData(1, 2, 3); Assert.That(data.ElementAtOrDefault(0), Is.EqualTo(1)); Assert.That(data.IsEnumerated, Is.False); }
public void ElementAtOrDefaultListNegativeIndex() { ListData <int> data = ListData(1, 2, 3); Assert.That(data.ElementAtOrDefault(-5), Is.EqualTo(0)); Assert.That(data.IsEnumerated, Is.False); }
public void ElementAtOrDefaultListOutOfBounds() { ListData <int> data = ListData(1, 2, 3); Assert.That(data.ElementAtOrDefault(5), Is.EqualTo(0)); Assert.That(data.IsEnumerated, Is.False); }
public void ElementAtOrDefaultEmptyListSource() { ListData <object> data = EmptyListData; Assert.That(data.ElementAtOrDefault(0), Is.Null); Assert.That(data.IsEnumerated, Is.False); // # Should not enumerate due to IList optimization }