using System; using FruityFoundation.Base.Structures; using NUnit.Framework; namespace Base.Tests.Structures; public class MaybeExtensionTests { [Test] public void EnumerableFirstOrEmptyTests() { Assert.AreEqual(Maybe.Empty(), Array.Empty().FirstOrEmpty()); Assert.AreEqual(Maybe.Just("banana"), new[] { "banana" }.FirstOrEmpty()); } [Test] public void TestToMaybe() { Assert.AreEqual(Maybe.Empty(), Maybe.Empty()); Assert.AreNotEqual(Maybe.Just(293921), Maybe.Just(2)); } [Test] public void MaybeNullableTests() { Assert.IsNull(Maybe.Empty().ToNullable()); Assert.IsNull(Maybe.Just(0, hasValue: _ => false).ToNullable()); } }