public void Parse_Currency_ShoulReturn_DollarsAndCents() { //Arrange var amount = new decimal(123.45); _currency = new ParsedCurrency { Dollars = 123, Cents = 45 }; //Action var result = _parserService.Parse(amount); //Assert Assert.AreEqual(result.Dollars, _currency.Dollars); Assert.AreEqual(result.Cents, _currency.Cents); }
public ResponseCurrencyModel ConvertToWords(RequestCurrencyModel model) { //Validate //Parse Dollars and Cents var parsedCurrency = _currencyParser.Parse(model.Currency); //Convert Dollars to words var dollarsInWords = NumberToWords(parsedCurrency.Dollars); //Convert Cents to words var centsInWords = NumberToWords(parsedCurrency.Cents); //Foramt Dollars & Cents var currencyInWords = _currencyFormatter.Format(dollarsInWords, centsInWords); //retrun; return(new ResponseCurrencyModel { Name = model.Name, CurrencyInWords = currencyInWords }); }