public void InjectorUpdateSuccessFive()
        {
            IInjectorStorage injectorStorage = new InjectorStorage();
            Injector         myInjector      = CreateInjectorForTest(
                "李某某",
                "男",
                "17733441111",
                "3",
                "2013-10-09");

            Injector createdInjector =
                injectorStorage.CreateInjector(myInjector);

            Assert.AreNotEqual(
                0,
                createdInjector.InjectorID,
                string.Format("Could not create Injector:{0}",
                              createdInjector.InjectorID));

            myInjector.InjectorTime = Convert.ToDateTime("2013-11-13");

            injectorStorage.UpdateInjector(myInjector);

            Injector updatedInjector = injectorStorage.ReadInjector(
                createdInjector.InjectorID);

            AssertInjectorItemEqual(myInjector, updatedInjector);
        }
Beispiel #2
0
        private void btnModfiy_Click(object sender, EventArgs e)
        {
            IInjectorStorage injectorStorage = new InjectorStorage();
            Injector         injector        = new Injector();

            if (textInjectorName.Text.Trim() == "" || textInjectorSex.Text.Trim() == "" ||
                textInjectorPhone.Text.Trim() == "" || textInjectorNumber.Text.Trim() == "" ||
                dtpInjectorTime.Text.Trim() == "")
            {
                MessageBox.Show("请双击需要修改的记录!");
            }
            else
            {
                injector.InjectorName   = textInjectorName.Text;
                injector.InjectorSex    = textInjectorSex.Text;
                injector.InjectorPhone  = textInjectorPhone.Text;
                injector.InjectorNumber = Convert.ToInt32(textInjectorNumber.Text);
                injector.InjectorTime   = Convert.ToDateTime(dtpInjectorTime.Text);
                injector.InjectorID     = Convert.ToInt32(dgvInjector[0, dgvInjector.CurrentCell.RowIndex].Value.ToString());

                injectorStorage.UpdateInjector(injector);

                MessageBox.Show("更新成功!");

                textInjectorName.Text   = "";
                textInjectorSex.Text    = "";
                textInjectorPhone.Text  = "";
                textInjectorNumber.Text = "";
                dtpInjectorTime.Text    = "";
            }
        }
        public void InjectorUpdateFailureInjectorIdArgumentException()
        {
            IInjectorStorage injectorStorage = new InjectorStorage();
            Injector         myInjector      = CreateInjectorForTest(
                "李某某",
                "男",
                "17733441111",
                "3",
                "2013-10-09");

            injectorStorage.CreateInjector(myInjector);

            myInjector.InjectorID = int.MaxValue;

            injectorStorage.UpdateInjector(myInjector);
        }
        public void InjectorUpdateFailureInjectorNameArgumentNullException()
        {
            IInjectorStorage injectorStorage = new InjectorStorage();
            Injector         myInjector      = CreateInjectorForTest(
                "李某某",
                "男",
                "17733441111",
                "3",
                "2013-10-09");

            injectorStorage.CreateInjector(myInjector);

            myInjector.InjectorName = null;

            injectorStorage.UpdateInjector(myInjector);
        }
        public void InjectorUpdateFailureInjectorArgumentNullException()
        {
            IInjectorStorage injectorStorage = new InjectorStorage();

            injectorStorage.UpdateInjector(null);
        }