コード例 #1
0
        public void TestPurchase()
        {
            // Arrange
            string expected =
                @"1 Candy Bar @ $0.50 = $0.50" +
                Environment.NewLine +
                @"2 Soda @ $1.00 = $2.00" +
                Environment.NewLine +
                @"SubTotal = $2.50" +
                Environment.NewLine +
                @"Tax (10%) = $0.25" +
                Environment.NewLine +
                @"Total = $2.75" +
                Environment.NewLine;

            // Act
            m_Sut.AddItem(1,
                          "Candy Bar",
                          0.50);
            m_Sut.AddItem(2,
                          "Soda",
                          1);

            // Assert
            Assert.AreEqual(expected,
                            m_Sut.ToString());
        }