public void ChooseTest() { var withNothing = new[] { Maybe.Just(1), Maybe.Nothing }; var withoutNothing = new[] { Maybe.Just(1), Maybe.Just(2) }; var onlyNothing = new Maybe <int>[] { Maybe.Nothing }; var emtpy = new Maybe <int> [0]; Assert.AreEqual(new[] { 1 }, withNothing.Choose()); Assert.AreEqual(new[] { 1, 2 }, withoutNothing.Choose()); Assert.IsEmpty(onlyNothing.Choose()); Assert.IsEmpty(emtpy.Choose()); }
public void ChooseTest() { var withNothing = new[] { Maybe.Just(1), Maybe.Nothing }; var withoutNothing = new[] { Maybe.Just(1), Maybe.Just(2) }; var onlyNothing = new Maybe<int>[] { Maybe.Nothing }; var emtpy = new Maybe<int>[0]; Assert.AreEqual(new[] { 1 }, withNothing.Choose()); Assert.AreEqual(new[] { 1, 2 }, withoutNothing.Choose()); Assert.IsEmpty(onlyNothing.Choose()); Assert.IsEmpty(emtpy.Choose()); }