예제 #1
0
        public void Test_Add_Get_Purchases()
        {
            string item1     = "potato";
            int    item2     = 15;
            int    item3     = 200;
            string expected1 = "potato";
            double expected2 = 15;
            int    expected3 = 200;

            facade.AddPurchase(item1, item2, item3);
            string actual1 = (facade.GetPurchases().Rows[0].ItemArray[1].ToString());
            double actual2 = (Convert.ToDouble(facade.GetPurchases().Rows[0].ItemArray[2]));
            int    actual3 = (Convert.ToInt32(facade.GetPurchases().Rows[0].ItemArray[3]));

            Assert.AreEqual(expected1, actual1);
            Assert.AreEqual(expected2, actual2);
            Assert.AreEqual(expected3, actual3);
        }
예제 #2
0
 private void button4_Click(object sender, EventArgs e)
 {
     facade = new Facade();
     try
     {
         facade.AddPurchase(textBox11.Text, Convert.ToDecimal(textBox10.Text), Convert.ToInt32(textBox9.Text));
         lb_error.Visible = false;
     }
     catch (Exception)
     {
         lb_error.Visible = true;
     }
     if (lb_error.Visible != true)
     {
         textBox11.Text           = "";
         textBox10.Text           = "";
         textBox9.Text            = "";
         dataGridView7.DataSource = facade.GetPurchases();
     }
 }