Example #1
0
        public void Should_Update_Shippers(Shipper existing)
        {
            //Arrange
            existing.Phone = "780.999.9998";
            var sut = new NorthwindManager();

            //Act
            sut.UpdateShipper(existing);

            //Assert
            var actual = sut.GetShipper(existing.ShipperID);
            Assert.NotNull(actual);
            Assert.Equal(existing.Phone, actual.Phone);
            Assert.Equal(existing.CompanyName, actual.CompanyName);
        }
Example #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                int shipperId;
                if (int.TryParse(lblShipperID.Text, out shipperId))
                {
                    //do the update...
                    var info = new Shipper()
                    {
                        ShipperID = shipperId,
                        CompanyName = txtCompanyName.Text,
                        Phone = txtPhone.Text
                    };

                    NorthwindManager mgr = new NorthwindManager();
                    mgr.UpdateShipper(info);
                    PopulateShippersComboBox();
                    cboShippers.SelectedValue = shipperId;

                }
                else
                {
                    MessageBox.Show("Please select a shipper before clicking [Lookup Shipper]");
                }

            }
            catch (Exception ex)
            {
                //TODO: Log the exception
                MessageBox.Show("Error: " + ex.Message);
            }
        }