From 1125169c67f8f6d833195c7d5e77b4982fe15fb6 Mon Sep 17 00:00:00 2001 From: Mike Marynowski Date: Thu, 7 Mar 2024 19:19:13 -0500 Subject: [PATCH] Add collection expression tests --- .../MoneySetTests/CollectionExpressions.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Tests/Singulink.Globalization.Currency.Tests/MoneySetTests/CollectionExpressions.cs diff --git a/Tests/Singulink.Globalization.Currency.Tests/MoneySetTests/CollectionExpressions.cs b/Tests/Singulink.Globalization.Currency.Tests/MoneySetTests/CollectionExpressions.cs new file mode 100644 index 0000000..95662d0 --- /dev/null +++ b/Tests/Singulink.Globalization.Currency.Tests/MoneySetTests/CollectionExpressions.cs @@ -0,0 +1,60 @@ + +namespace Singulink.Globalization.Tests.MoneySetTests; + +[PrefixTestClass] +public class CollectionExpressions +{ + private static readonly ImmutableArray SetValues = [Money.Create(123, "USD"), Money.Create(456, "EUR"), Money.Create(789, "JPY")]; + + [TestMethod] + public void CreateMoneySet() + { + MoneySet set = [..SetValues]; + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateSortedMoneySet() + { + SortedMoneySet set = [.. SetValues]; + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateImmutableMoneySet() + { + ImmutableMoneySet set = [.. SetValues]; + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateImmutableSortedMoneySet() + { + ImmutableSortedMoneySet set = [.. SetValues]; + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateIReadOnlyMoneySet() + { + IReadOnlyMoneySet set = [.. SetValues]; + set.ShouldBeOfType(); + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateIMoneySet() + { + IMoneySet set = [.. SetValues]; + set.ShouldBeOfType(); + set.ShouldBe(SetValues, ignoreOrder: true); + } + + [TestMethod] + public void CreateIImmutableMoneySet() + { + IImmutableMoneySet set = [.. SetValues]; + set.ShouldBeOfType(); + set.ShouldBe(SetValues, ignoreOrder: true); + } +}