public void Test_ElementAtOrNone() { Assert.That(() => MaybeExtensions.ElementAtOrNone <int>(null, 0), Throws.ArgumentNullException); Assert.That(() => Array.Empty <int>().SelectSome(x => x).ElementAtOrNone(-10), Throws.ArgumentException); var coll = new[] { 12, 12351, 123, 11, 0, -88 }; Assert.AreEqual(coll[3], coll.ElementAtOrNone(3).Match(int.MinValue)); Assert.That(() => coll.ElementAtOrNone(6).Match(new IndexOutOfRangeException()), Throws.InstanceOf <IndexOutOfRangeException>()); }