public void AddConsignor() { // SETUP int nextConsignor = GetMaxConsignorID() + 1; ConsignorClasses.Consignor c = new Consignor(); ConsignorClasses.ConsignorUtilities u = new ConsignorUtilities(); c.Address1City = testAddressCity; c.Address1State = testAddressState; c.Address1Street = testStreet; c.Address1Zip = testZip; c.CellPhone = testCell; c.Comments = testComments; c.ConsignorID = 0; c.Donate = true; c.EmailAddress = testEmail; c.FirstName = testFirstName; c.HomePhone = testHomePhone; c.LastName = testLastName; c.WorkPhone = testWorkPhone; // TRIGGER int newConsignorID = u.AddNewConsignor(c); // VALIDATE Assert.AreEqual(nextConsignor, newConsignorID, "expected different number"); }
private void NewConsignorInsert() { int count; ConsignorClasses.ConsignorUtilities cu = new ConsignorClasses.ConsignorUtilities(); ConsignorClasses.Consignor c = new ConsignorClasses.Consignor(); c.LastName = txtLastName.Text; c.FirstName = txtFirstName.Text; c.Address1Street = txtAddress.Text; c.Address1City = txtCity.Text; c.Address1State = txtState.Text; c.Address1Zip = txtZipCode.Text; c.HomePhone = txtHomePhone.Text; c.WorkPhone = txtWorkPhone.Text; c.CellPhone = txtCellPhone.Text; c.EmailAddress = txtemail.Text; c.Comments = txtComments.Text; c.Donate = ckDonate.Checked; c.CreateBy = "NewConsignor"; count = cu.AddNewConsignor(c); switch (count) { case -1: MessageBox.Show("There was a SQL Data Error", Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK); break; case -2: MessageBox.Show("C# Error", Properties.Settings.Default.MessageBoxTitle, MessageBoxButtons.OK); break; default: txtConsignorID.Visible = true; txtConsignorID.Text = count.ToString(); txtConsignorID.Enabled = false; ClearConsignor(); break; } }