public AtWord(Language language, CurrencySymbol currencySymbol, CurrencyOptions currencyOptions) { _currencySymbol = currencySymbol; _currencyOptions = currencyOptions; _currencyTransformer = new CurrencyTransformerFactory().Create(language); }
public void GenericCurrencyTransformer() { var options = new CurrencyOptions(); Assert.Equal("one hundred dollars zero cents", _transformer.ToWords(100, _currency, options)); Assert.Equal("one hundred dollars one cent", _transformer.ToWords(100.01m, _currency, options)); Assert.Equal("one hundred dollars ten cents", _transformer.ToWords(100.1m, _currency, options)); Assert.Equal("one hundred dollars fifty seven cents", _transformer.ToWords(100.57m, _currency, options)); }
public void GenericCurrencyTransformer_IntegerAndDecimalPartSeparator() { var options = new CurrencyOptions { IntegerAndDecimalPartSeparator = " and " }; Assert.Equal("one hundred dollars and zero cents", _transformer.ToWords(100, _currency, options)); Assert.Equal("one hundred dollars and one cent", _transformer.ToWords(100.01m, _currency, options)); Assert.Equal("one hundred dollars and ten cents", _transformer.ToWords(100.1m, _currency, options)); Assert.Equal("one hundred dollars and fifty seven cents", _transformer.ToWords(100.57m, _currency, options)); }
public void GenericCurrencyTransformer_IntegerPartOnly() { var options = new CurrencyOptions { IntegerPartOnly = true }; Assert.Equal("one hundred dollars", _transformer.ToWords(100, _currency, options)); Assert.Equal("one hundred dollars", _transformer.ToWords(100.01m, _currency, options)); Assert.Equal("one hundred dollars", _transformer.ToWords(100.1m, _currency, options)); Assert.Equal("one hundred dollars", _transformer.ToWords(100.57m, _currency, options)); }
public void GenericCurrencyTransformer_DecimalAsFraction() { var options = new CurrencyOptions { DecimalAsFraction = true }; Assert.Equal("one hundred dollars 0/100 cents", _transformer.ToWords(100, _currency, options)); Assert.Equal("one hundred dollars 1/100 cent", _transformer.ToWords(100.01m, _currency, options)); Assert.Equal("one hundred dollars 10/100 cents", _transformer.ToWords(100.1m, _currency, options)); Assert.Equal("one hundred dollars 57/100 cents", _transformer.ToWords(100.57m, _currency, options)); }
public Currency(CurrencyOptions currencyOption) { this.currencyOption = currencyOption; this.fractionDigits = (int)RoundingMode.Default; }
public Currency(CurrencyOptions currencyOption, sbyte fractionDigits) { this.currencyOption = currencyOption; this.fractionDigits = fractionDigits; }
public AtWordBuilder() { _currencyOptions = new CurrencyOptions(); }
public ValuesController(IOptions <CurrencyOptions> currencies, Lazy <ICurrencyProvider> provider) { _currencies = currencies.Value; }
public CurrenciesController(IOptions <CurrencyOptions> currencies) { _currencies = currencies.Value; }