Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mikernet committed Mar 8, 2024
1 parent 136d784 commit 7a243ef
Show file tree
Hide file tree
Showing 50 changed files with 206 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ public class ToImmutableMoneySet
private static readonly ImmutableArray<Money> SetValues = [new(100m, "USD"), new(50m, "CAD"), new(25m, "EUR")];

[PrefixTestClass]
public class Set : Tests<MoneySet> { }
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

[TestMethod]
public void OtherCollection_SetsRegistry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public class ToImmutableSortedMoneySet
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

[TestMethod]
public void OtherCollection_SetsRegistryAndCopiesValues()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ public class ToMoneySet
private static readonly ImmutableArray<Money> SetValues = [new(100m, "USD"), new(50m, "CAD"), new(25m, "EUR")];

[PrefixTestClass]
public class Set : Tests<MoneySet> { }
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

[TestMethod]
public void OtherCollection_SetsRegistry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public class ToSortedMoneySet
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

[TestMethod]
public void OtherCollection_SetsRegistryAndCopiesValues()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

public static partial class Add
{
[PrefixTestClass]
public class ImmutableSet : Immutable<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Immutable<ImmutableSortedMoneySet>;

public class Immutable<T> where T : IImmutableMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

public static partial class Add
{
[PrefixTestClass]
public class Set : Mutable<MoneySet>;

[PrefixTestClass]
public class SortedSet : Mutable<SortedMoneySet>;

public class Mutable<T> where T : IMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down
16 changes: 0 additions & 16 deletions Tests/Singulink.Globalization.Currency.Tests/MoneySetTests/Add.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
namespace Singulink.Globalization.Tests.MoneySetTests;
public static partial class AddRange
{
[PrefixTestClass]
public class ImmutableSet : Immutable<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Immutable<ImmutableSortedMoneySet>;

public class Immutable<T> where T : IImmutableMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

public static partial class AddRange
{
[PrefixTestClass]
public class Set : Mutable<MoneySet>;

[PrefixTestClass]
public class SortedSet : Mutable<SortedMoneySet>;

public class Mutable<T> where T : IMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

public static partial class Clear
{
[PrefixTestClass]
public class ImmutableSet : Immutable<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Immutable<ImmutableSortedMoneySet>;

public class Immutable<T> where T : IImmutableMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

public static partial class Clear
{
[PrefixTestClass]
public class Set : Mutable<MoneySet>;

[PrefixTestClass]
public class SortedSet : Mutable<SortedMoneySet>;

public class Mutable<T> where T : IMoneySet
{
private static readonly Money Usd100 = new(100m, "USD");
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Singulink.Globalization.Tests.MoneySetTests;
namespace Singulink.Globalization.Tests.MoneySetTests;
public static class Contains
{
[PrefixTestClass]
public class Set : Tests<MoneySet> { }
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

public class Tests<T> where T : IReadOnlyMoneySet
{
Expand All @@ -32,9 +25,7 @@ public class Tests<T> where T : IReadOnlyMoneySet
public void Money_ValueExists_ReturnsTrue()
{
Set.Contains(Usd100).ShouldBeTrue();

Set.Contains(Cad50).ShouldBeTrue();

Set.Contains(Eur25).ShouldBeTrue();
}

Expand All @@ -50,17 +41,15 @@ public void Money_ValueDoesNotExist_ReturnsFalse()
///////////////////////////

[TestMethod]
public void CurrencyAmount_ValueExists_ReturnsTrue()
public void AmountAndCurrency_ValueExists_ReturnsTrue()
{
Set.Contains(Usd100.Amount, Usd100.Currency).ShouldBeTrue();

Set.Contains(Cad50.Amount, Cad50.Currency).ShouldBeTrue();

Set.Contains(Eur25.Amount, Eur25.Currency).ShouldBeTrue();
}

[TestMethod]
public void CurrencyAmount_ValueDoesNotExist_ReturnsFalse()
public void AmountAndCurrency_ValueDoesNotExist_ReturnsFalse()
{
var newCurrency = new Currency("New Currency", "XXXX", "X", 2);

Expand All @@ -71,17 +60,15 @@ public void CurrencyAmount_ValueDoesNotExist_ReturnsFalse()
///////////////////////////

[TestMethod]
public void CurrencyCodeAmount_ValueExists_ReturnsTrue()
public void AmountAndCurrencyCode_ValueExists_ReturnsTrue()
{
Set.Contains(Usd100.Amount, Usd100.Currency.CurrencyCode).ShouldBeTrue();

Set.Contains(Cad50.Amount, Cad50.Currency.CurrencyCode).ShouldBeTrue();

Set.Contains(Eur25.Amount, Eur25.Currency.CurrencyCode).ShouldBeTrue();
}

[TestMethod]
public void CurrencyCodeAmount_ValueDoesNotExist_ReturnsFalse()
public void AmountAndCurrencyCode_ValueDoesNotExist_ReturnsFalse()
{
Set.Contains(0m, "GBP").ShouldBeFalse();
Set.Contains(0m, "XXXX").ShouldBeFalse();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Singulink.Globalization.Tests.MoneySetTests;
namespace Singulink.Globalization.Tests.MoneySetTests;
public static class ContainsCurrency
{
[PrefixTestClass]
public class Set : Tests<MoneySet> { }
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

public class Tests<T> where T : IReadOnlyMoneySet
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Singulink.Globalization.Tests.MoneySetTests;
namespace Singulink.Globalization.Tests.MoneySetTests;
public static class Indexers
{
[PrefixTestClass]
public class Set : Tests<MoneySet> { }
public class Set : Tests<MoneySet>;

[PrefixTestClass]
public class SortedSet : Tests<SortedMoneySet> { }
public class SortedSet : Tests<SortedMoneySet>;

[PrefixTestClass]
public class ImmutableSet : Tests<ImmutableMoneySet> { }
public class ImmutableSet : Tests<ImmutableMoneySet>;

[PrefixTestClass]
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet> { }
public class ImmutableSortedSet : Tests<ImmutableSortedMoneySet>;

public class Tests<T> where T : IReadOnlyMoneySet
{
Expand All @@ -31,9 +25,7 @@ public class Tests<T> where T : IReadOnlyMoneySet
public void Currency_ValueExists_ReturnsValue()
{
_set[Currency.Get("USD")].ShouldBe(Usd100);

_set[Currency.Get("CAD")].ShouldBe(Cad50);

_set[Currency.Get("EUR")].ShouldBe(Eur25);
}

Expand All @@ -52,9 +44,7 @@ public void Currency_ValueDoesNotExist_ReturnsDefault()
public void CurrencyCode_ValueExists_ReturnsValue()
{
_set["USD"].ShouldBe(Usd100);

_set["CAD"].ShouldBe(Cad50);

_set["EUR"].ShouldBe(Eur25);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace Singulink.Globalization.Tests.MoneySetTests;
namespace Singulink.Globalization.Tests.MoneySetTests;

[PrefixTestClass]
public class IsSorted
public class IsSorted
{
[TestMethod]
public void Sorted_UnsortedSets_IsFalse()
public void UnsortedSets_IsFalse()
{
IReadOnlyMoneySet sortedMoneySet = new MoneySet();
IReadOnlyMoneySet immutableSortedMoneySet = ImmutableMoneySet.Create();
Expand All @@ -14,12 +14,12 @@ public void Sorted_UnsortedSets_IsFalse()
}

[TestMethod]
public void Sorted_SortedSets_IsTrue()
public void SortedSets_IsTrue()
{
IReadOnlyMoneySet sortedMoneySet = new SortedMoneySet();
IReadOnlyMoneySet immutableSortedMoneySet = ImmutableSortedMoneySet.Create();

sortedMoneySet.IsSorted.ShouldBeTrue();
immutableSortedMoneySet.IsSorted.ShouldBeTrue();
}
}
}
Loading

0 comments on commit 7a243ef

Please sign in to comment.