FruityFoundation/Base.Tests/Extensions/NullableExtensionTests.cs

24 lines
710 B
C#
Raw Normal View History

2022-02-24 19:11:28 -05:00
using FruityFoundation.Base.Extensions;
using FruityFoundation.Base.Structures;
2021-11-19 00:12:02 -05:00
using NUnit.Framework;
namespace Base.Tests.Extensions;
public class NullableExtensionTests
{
[Test]
public void TestNullableStructOfNullToMaybe() =>
Assert.AreEqual(Maybe<int>.Empty(), ((int?)null).ToMaybe());
[Test]
public void TestNullableStructOfValueToMaybe() =>
Assert.AreEqual(Maybe<int>.Create(25), ((int?)25).ToMaybe());
[Test]
public void TestNullableRefOfNullToMaybe() =>
Assert.AreEqual(Maybe<object>.Empty(), ((object?)null).ToMaybe());
[Test]
public void TestNullableRefOfValueToMaybe() =>
Assert.AreEqual(Maybe<object>.Create(new {}), ((object?)new {}).ToMaybe());
}