public void Is_successfully_created_when_both_code_and_exchange_rate_are_provided() { Action createQuoteCurrency = () => QuoteCurrency.Of(CurrencyCode.Of(USD), CurrencyExchangeRate.Of(BTC_to_USD)); createQuoteCurrency.Should().NotThrow(); }
public void Forbids_improperly_formatted_value(string value) { Action createCurrencyCode = () => CurrencyCode.Of(value); createCurrencyCode.Should().ThrowExactly <DomainException>() .Which.Error.Should().Be(CurrencyCodeInvalidFormat); }
public void Requires_rate() { Action createQuoteCurrency = () => QuoteCurrency.Of(CurrencyCode.Of(USD), null); createQuoteCurrency.Should().ThrowExactly <ArgumentException>(); }
public void Requires_non_blank_value(string value) { Action createCurrencyCode = () => CurrencyCode.Of(value); createCurrencyCode.Should().ThrowExactly <DomainException>() .Which.Error.Should().Be(MissingCurrencyCode); }
public static QuoteCurrency Of(CurrencyCode code, CurrencyExchangeRate exchangeRate) { if (code is null) { throw new ArgumentException( $"{nameof(QuoteCurrency)} {nameof(code)} is required.", nameof(code)); } if (exchangeRate is null) { throw new ArgumentException( $"{nameof(QuoteCurrency)} {nameof(exchangeRate)} is required.", nameof(exchangeRate)); } return(new QuoteCurrency(code, exchangeRate)); }
private bool Equals(CurrencyCode other) => string.Equals(_value, other._value, StringComparison.OrdinalIgnoreCase);
public void Uppercase_the_value() { string currencyCodeValue = CurrencyCode.Of("bTc"); currencyCodeValue.Should().Be(BTC); }
public void Is_successfully_created_from_a_non_blank_value() { Action createCurrencyCode = () => CurrencyCode.Of(BTC); createCurrencyCode.Should().NotThrow(); }
private QuoteCurrency(CurrencyCode code, CurrencyExchangeRate exchangeRate) { Code = code; ExchangeRate = exchangeRate; }