コード例 #1
0
        /// <summary>
        /// Returns the price value in string format.
        /// </summary>
        /// <typeparam name="T">The concrete type of the price.</typeparam>
        /// <param name="price">The source price.</param>
        /// <returns>The user-friendly string with real price value.</returns>
        public static string ValueToDecimalAsString <T>(this T price)
            where T : IPriceWithCurrency
        {
            var amount = ValueToDecimal(price);

            return(MoneyHelper.ConvertFromDecimalRepresentationToString(amount, price?.DecimalPlaces));
        }
コード例 #2
0
        public void ConvertFromDecimalRepresentationToString_ReturnsCorrectly(decimal sourceAmount, int?decimalPlaces, string expected)
        {
            var actual = MoneyHelper.ConvertFromDecimalRepresentationToString(sourceAmount, decimalPlaces);

            Assert.AreEqual(expected, actual);
        }