public void BuyerExceptionTest() { //Variables var buyer = new Buyer(); // Try Catch block to test the fail condition try { // Call CreateOrder method buyer.CreateOrder(new Contract()); } catch (Exception e) { // Assert that test threw exception and succeeded Assert.AreEqual("Invalid Contract", e.Message); } // Try Catch block to test the fail condition try { // Call GenerateInvoice method buyer.GenerateInvoice(new Order()); } catch (Exception e) { // Assert that test threw exception and succeeded Assert.AreEqual("Invalid Order", e.Message); } }
public void BuyerFunctionalTest() { //Variables var buyer = new Buyer(); // Try Catch block to test the fail condition try { // Call CreateOrder method buyer.CreateOrder(new Contract()); } catch (Exception e) { // Assert that test failed throw new AssertFailedException(); } // Try Catch block to test the fail condition try { // Call GenerateInvoice method buyer.GenerateInvoice(new Order()); } catch (Exception e) { // Assert that test failed throw new AssertFailedException(); } }
private void invoiceButton_Click(object sender, RoutedEventArgs e) { DataAccess dal = new DataAccess(); DataRowView rows = (DataRowView)currentContractsDataGrid.SelectedItems[0]; int contractID = (int)rows.Row.ItemArray[0]; int orderID = (int)rows.Row.ItemArray[1]; DataRow contractInfo = dal.GetContractByID(contractID); DataRow orderInfo = dal.GetOrderByID(orderID); /// pass to buyer to generate invoice CurrentBuyer.GenerateInvoice(contractInfo, orderInfo); System.Windows.MessageBox.Show("Invoice Created!"); }