コード例 #1
0
        public void FirstOrDefaultNonEmptyListSource()
        {
            ListData <int> data = ListData(1, 2, 3);

            Assert.That(data.FirstOrDefault(), Is.EqualTo(1));
            Assert.That(data.IsEnumerated, Is.False);
        }
コード例 #2
0
        public void FirstOrDefaultEmptyListSource()
        {
            ListData <object> data = EmptyListData;

            Assert.That(data.FirstOrDefault(), Is.Null);
            Assert.That(data.IsEnumerated, Is.False); // # Should not enumerate due to IList optimization
        }