コード例 #1
0
 public void ToStringTestForZero()
 {
     Currency oTarget = new Currency();
     oTarget.Amount = 0;
     // ReSharper disable ConvertToConstant.Local
     string oExpected = "0.00";
     // ReSharper restore ConvertToConstant.Local
     string oActual = oTarget.ToString();
     Assert.AreEqual(oExpected, oActual);
 }
コード例 #2
0
 public void ToStringRoundingTest()
 {
     Currency oTarget = new Currency();
     oTarget.Amount = new decimal(13.388830000);
     // ReSharper disable ConvertToConstant.Local
     string oExpected = "13.39";
     // ReSharper restore ConvertToConstant.Local
     string oActual = oTarget.ToString();
     Assert.AreEqual(oExpected, oActual);
 }
コード例 #3
0
 public void ToStringTestForNegative()
 {
     Currency oTarget = new Currency();
     oTarget.Amount = new decimal(-13.59);
     // ReSharper disable ConvertToConstant.Local
     string oExpected = "-13.59";
     // ReSharper restore ConvertToConstant.Local
     string oActual = oTarget.ToString();
     Assert.AreEqual(oExpected, oActual);
 }
コード例 #4
0
        public string PrintInvoice()
        {
            var oStringBuffer = new StringBuilder();
            var oTotal = new Currency();

            foreach (var oLineItem in mLineItems) {
                oStringBuffer.AppendLine(oLineItem.ToString());
                oTotal.Amount += oLineItem.DisplayPrice.Amount;
            }

            oStringBuffer.AppendLine("Sales Taxes: " + mSalesTax);
            oStringBuffer.AppendLine("Total: " + oTotal).AppendLine();

            return oStringBuffer.ToString();
        }