public void LastMaybePredicateWhenNotPresent() { var source = new[] { new TestObject {Id = 1} }; Assert.IsFalse(source.LastMaybe(x => x.Id == 2).HasValue); }
public void LastMaybeWhenPresent() { var source = new[] { new TestObject {Id = 1}, new TestObject {Id = 2} }; Assert.AreSame(source[1], source.LastMaybe().Value); }
public void LastMaybePredicateWhenPresent() { var source = new[] { new TestObject {Id = 1}, new TestObject {Id = 2}, new TestObject {Id = 2} }; Assert.AreSame(source[2], source.LastMaybe(x => x.Id == 2).Value); }