-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Step 2: Created default subscription, with default provider
- Loading branch information
1 parent
6ed2bf5
commit 76dcdb6
Showing
77 changed files
with
1,671 additions
and
339 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
namespace Application.Resources.Shared; | ||
|
||
/// <summary> | ||
/// Maintains the internal state for the billing provider | ||
/// </summary> | ||
public class BillingProviderState : Dictionary<string, string> | ||
{ | ||
public BillingProviderState() | ||
{ | ||
} | ||
|
||
public BillingProviderState(Dictionary<string, string> properties) : base(properties) | ||
{ | ||
} | ||
} |
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
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
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,139 @@ | ||
using Common.Extensions; | ||
using FluentAssertions; | ||
using ISO._4217; | ||
using Xunit; | ||
|
||
namespace Common.UnitTests; | ||
|
||
[Trait("Category", "Unit")] | ||
public class CurrencyCodesSpec | ||
{ | ||
[Fact] | ||
public void WhenExistsAndUnknown_ThenReturnsFalse() | ||
{ | ||
var result = CurrencyCodes.Exists("notacurrencycode"); | ||
|
||
result.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void WhenExistsByCode_ThenReturnsTrue() | ||
{ | ||
var result = CurrencyCodes.Exists(CurrencyCodes.Default.Code); | ||
|
||
result.Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void WhenExistsByNumeric_ThenReturnsTrue() | ||
{ | ||
var result = CurrencyCodes.Exists(CurrencyCodes.Default.Numeric); | ||
|
||
result.Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void WhenFindAndUnknown_ThenReturnsNull() | ||
{ | ||
var result = CurrencyCodes.Find("notacurrencycode"); | ||
|
||
result.Should().BeNull(); | ||
} | ||
|
||
[Fact] | ||
public void WhenFindByCode_ThenReturnsTrue() | ||
{ | ||
var result = CurrencyCodes.Find(CurrencyCodes.Default.Code); | ||
|
||
result.Should().Be(CurrencyCodes.Default); | ||
} | ||
|
||
[Fact] | ||
public void WhenFindByNumeric_ThenReturnsTrue() | ||
{ | ||
var result = CurrencyCodes.Find(CurrencyCodes.Default.Numeric); | ||
|
||
result.Should().Be(CurrencyCodes.Default); | ||
} | ||
|
||
[Fact] | ||
public void WhenFindForEveryCurrency_ThenReturnsCode() | ||
{ | ||
var currencies = CurrencyCodesResolver.Codes | ||
.Where(cur => cur.Code.HasValue()) | ||
.ToList(); | ||
foreach (var currency in currencies) | ||
{ | ||
var result = CurrencyCodes.Find(currency.Code); | ||
|
||
result.Should().NotBeNull($"{currency.Name} should have been found by Code"); | ||
} | ||
|
||
foreach (var currency in currencies) | ||
{ | ||
var result = CurrencyCodes.Find(currency.Num); | ||
|
||
result.Should().NotBeNull($"{currency.Name} should have been found by NumericCode"); | ||
} | ||
} | ||
|
||
[Fact] | ||
public void WhenCreateIso4217_ThenReturnsInstance() | ||
{ | ||
var result = CurrencyCodeIso4217.Create("ashortname", "analpha2", "100", CurrencyDecimalKind.TwoDecimal); | ||
|
||
result.ShortName.Should().Be("ashortname"); | ||
result.Code.Should().Be("analpha2"); | ||
result.Kind.Should().Be(CurrencyDecimalKind.TwoDecimal); | ||
result.Numeric.Should().Be("100"); | ||
} | ||
|
||
[Fact] | ||
public void WhenEqualsAndNotTheSameNumeric_ThenReturnsFalse() | ||
{ | ||
var currency1 = CurrencyCodeIso4217.Create("ashortname", "analpha2", "100", CurrencyDecimalKind.Unknown); | ||
var currency2 = CurrencyCodeIso4217.Create("ashortname", "analpha2", "101", CurrencyDecimalKind.Unknown); | ||
|
||
var result = currency1 == currency2; | ||
|
||
result.Should().BeFalse(); | ||
} | ||
|
||
[Fact] | ||
public void WhenEqualsAndSameNumeric_ThenReturnsTrue() | ||
{ | ||
var currency1 = CurrencyCodeIso4217.Create("ashortname1", "analpha21", "100", CurrencyDecimalKind.Unknown); | ||
var currency2 = CurrencyCodeIso4217.Create("ashortname2", "analpha22", "100", CurrencyDecimalKind.Unknown); | ||
|
||
var result = currency1 == currency2; | ||
|
||
result.Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void WhenToCurrencyWithAThousandAndOne_ThenReturnsUnitedStatesDollars() | ||
{ | ||
var code = CurrencyCodes.UnitedStatesDollar.Code; | ||
var result = CurrencyCodes.ToCurrency(code, 1001); | ||
|
||
result.Should().Be(10.01M); | ||
} | ||
|
||
[Fact] | ||
public void WhenToCurrencyWithAThousandAndOne_ThenReturnsKuwaitiDinars() | ||
{ | ||
var code = CurrencyCodes.KuwaitiDinar.Code; | ||
var result = CurrencyCodes.ToCurrency(code, 1001); | ||
|
||
result.Should().Be(1.001M); | ||
} | ||
|
||
[Fact] | ||
public void WhenToCurrencyWithAThousandAndOne_ThenReturnsChileanFomentos() | ||
{ | ||
var code = CurrencyCodes.ChileanFomento.Code; | ||
var result = CurrencyCodes.ToCurrency(code, 1001); | ||
|
||
result.Should().Be(0.1001M); | ||
} | ||
} |
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
Oops, something went wrong.