public void Test_Add_Get_Consumptions() { string item1 = "borsh"; string item2 = "potato"; int item3 = 1; string expected1 = "borsh"; string expected2 = "potato"; int expected3 = 1; facade.AddConsumption(item1, item2, item3); string actual1 = (facade.GetConsumptiones().Rows[0].ItemArray[1].ToString()); string actual2 = (facade.GetConsumptiones().Rows[0].ItemArray[2].ToString()); int actual3 = (Convert.ToInt32(facade.GetConsumptiones().Rows[0].ItemArray[3])); Assert.AreEqual(expected1, actual1); Assert.AreEqual(expected2, actual2); Assert.AreEqual(expected3, actual3); }
private void button3_Click(object sender, EventArgs e) { facade = new Facade(); try { facade.AddConsumption(textBox8.Text, textBox7.Text, Convert.ToSingle(textBox6.Text)); lb_error.Visible = false; } catch (Exception) { lb_error.Visible = true; } if (lb_error.Visible != true) { textBox8.Text = ""; textBox7.Text = ""; textBox6.Text = ""; dataGridView6.DataSource = facade.GetConsumptiones(); } }