diff --git a/Base.Tests/Structures/MaybeExtensionTests.cs b/Base.Tests/Structures/MaybeExtensionTests.cs index cc1814b..e3390bf 100644 --- a/Base.Tests/Structures/MaybeExtensionTests.cs +++ b/Base.Tests/Structures/MaybeExtensionTests.cs @@ -9,10 +9,46 @@ namespace Base.Tests.Structures; public class MaybeExtensionTests { [Test] - public void EnumerableFirstOrEmptyTests() + public void Enumerable_FirstOrEmpty_WithEmptyEnumerable_ReturnsEmptyMaybe() { - Assert.That(Array.Empty().FirstOrEmpty(), Is.EqualTo(Maybe.Empty())); - Assert.That(new[] { "banana" }.FirstOrEmpty(), Is.EqualTo(Maybe.Create("banana"))); + // Arrange + var data = Array.Empty(); + + // Act + var result = data.FirstOrEmpty(); + + // Assert + Assert.That(result, Is.InstanceOf>()); + Assert.That(result.HasValue, Is.False); + } + + [Test] + public void Enumerable_FirstOrEmpty_WithMatchingPredicate_ReturnsMaybeWithValue() + { + // Arrange + var data = new[] { 1, 2, 3, 4 }; + + // Act + var result = data.FirstOrEmpty(x => x > 1); + + // Assert + Assert.That(result, Is.InstanceOf>()); + Assert.That(result.HasValue, Is.True); + Assert.That(result.Value, Is.EqualTo(2)); + } + + [Test] + public void Enumerable_FirstOrEmpty_WithNonMatchingPredicate_ReturnsEmptyMaybe() + { + // Arrange + var data = new[] { 1, 2, 3, 4 }; + + // Act + var result = data.FirstOrEmpty(x => x > 100); + + // Assert + Assert.That(result, Is.InstanceOf>()); + Assert.That(result.HasValue, Is.False); } [Test]