示例#1
0
		static void Main(string[] args)
		{
			Customer customer1 = new Customer("Kirsi Kernel");
			customer1.AddItem(new InvoiceItem("Milk", 1.75f, 1));
			customer1.AddItem(new InvoiceItem("Beer", 5.25f, 1));
			customer1.AddItem(new InvoiceItem("Butter", 2.5f, 2));

			Console.WriteLine(customer1.ToString());
		}
示例#2
0
		public void TotalSumTest()
		{
			Customer customer1 = new Customer("Kirsi Kernel");
			customer1.AddItem(new InvoiceItem("Milk", 1.75f, 1));
			customer1.AddItem(new InvoiceItem("Beer", 5.25f, 2));

			float price1 = 1.75f;
			float price2 = 5.25f;
			float amount1 = 1;
			float amount2 = 2;

			float expected = price1 * amount1 + price2 * amount2;

			Assert.AreEqual(expected, customer1.TotalSum());
		}