public void FirstMaybePredicateWhenNotPresent() { var source = new[] { new TestObject {Id = 1} }; Assert.IsFalse(source.FirstMaybe(x => x.Id == 2).HasValue); }
public void FirstMaybeWhenPresent() { var source = new[] { new TestObject {Id = 1}, new TestObject {Id = 2} }; Assert.AreSame(source[0], source.FirstMaybe().Value); }
public void FirstMaybePredicateWhenPresent() { var source = new[] { new TestObject {Id = 1}, new TestObject {Id = 2}, new TestObject {Id = 2} }; Assert.AreSame(source[1], source.FirstMaybe(x => x.Id == 2).Value); }