コード例 #1
0
        public void FormatPrice_WithWholeNumberPrice_AddsDecimals()
        {
            //arrange
            MockReport report        = new MockReport();
            double     price         = 13;
            string     expectedPrice = "13.00";

            //act
            string actualPrice = report.FormatPrice(price);

            //assert
            Assert.AreEqual(expectedPrice, actualPrice, "Decimal places not correctly added to price");
        }
コード例 #2
0
        public void FormatPrice_WithExtraDecimalPlace_RemovesDecimal()
        {
            //arrange
            MockReport report        = new MockReport();
            double     price         = 8.111;
            string     expectedPrice = "8.11";

            //act
            string actualPrice = report.FormatPrice(price);

            //assert
            Assert.AreEqual(expectedPrice, actualPrice, "Decimal places not correctly remove from price");
        }