-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finsh off code coverate for mutable set ctors
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
Tests/Singulink.Globalization.Currency.Tests/Sets/MoneySetTests/Ctor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Singulink.Globalization.Tests.Sets.MoneySetTests; | ||
|
||
[PrefixTestClass] | ||
public class Ctor | ||
{ | ||
private static readonly Money Usd100 = new Money(100m, "USD"); | ||
private static readonly ImmutableArray<Money> SetValues = [Usd100, new(50m, "CAD"), new(25m, "EUR")]; | ||
|
||
[TestMethod] | ||
public void EmptyArray() | ||
{ | ||
var set = new MoneySet(Array.Empty<Money>()); | ||
set.Count.ShouldBe(0); | ||
set.ShouldBe([]); | ||
} | ||
|
||
[TestMethod] | ||
public void SomeDefaultValues_IgnoresDefaultValues() | ||
{ | ||
var set = new MoneySet([default, ..SetValues, default]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe(SetValues, ignoreOrder: true); | ||
} | ||
|
||
[TestMethod] | ||
public void ZeroValues_SkipsIfPresent() | ||
{ | ||
var set = new MoneySet([..SetValues, new(0m, "USD")]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe(SetValues, ignoreOrder: true); | ||
} | ||
|
||
[TestMethod] | ||
public void MultipleSameCurrencyValues_AddsSameCurrencyValuesTogether() | ||
{ | ||
var set = new MoneySet([..SetValues, ..SetValues, ..SetValues]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe([new(300m, "USD"), new(150m, "CAD"), new(75m, "EUR")], ignoreOrder: true); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
Tests/Singulink.Globalization.Currency.Tests/Sets/SortedMoneySet/Ctor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Singulink.Globalization.Tests.Sets.SortedMoneySetTests; | ||
|
||
[PrefixTestClass] | ||
public class Ctor | ||
{ | ||
private static readonly Money Usd100 = new Money(100m, "USD"); | ||
private static readonly ImmutableArray<Money> SetValues = [Usd100, new(50m, "CAD"), new(25m, "EUR")]; | ||
|
||
[TestMethod] | ||
public void EmptyArray() | ||
{ | ||
var set = new SortedMoneySet(Array.Empty<Money>()); | ||
set.Count.ShouldBe(0); | ||
set.ShouldBe([]); | ||
} | ||
|
||
[TestMethod] | ||
public void SomeDefaultValues_IgnoresDefaultValues() | ||
{ | ||
var set = new SortedMoneySet([default, ..SetValues, default]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe(SetValues, ignoreOrder: true); | ||
} | ||
|
||
[TestMethod] | ||
public void ZeroValues_SkipsIfPresent() | ||
{ | ||
var set = new SortedMoneySet([..SetValues, new(0m, "USD")]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe(SetValues, ignoreOrder: true); | ||
} | ||
|
||
[TestMethod] | ||
public void MultipleSameCurrencyValues_AddsSameCurrencyValuesTogether() | ||
{ | ||
var set = new SortedMoneySet([..SetValues, ..SetValues, ..SetValues]); | ||
set.Count.ShouldBe(3); | ||
set.ShouldBe([new(300m, "USD"), new(150m, "CAD"), new(75m, "EUR")], ignoreOrder: true); | ||
} | ||
} |