public void VaccineUpdateSuccessFive() { IVaccineStorage vaccineStorage = new VaccineStorage(); Vaccine myVaccine = CreateVaccineForTest( "狂犬疫苗1", "处方1", getManufacturersIDtwo(), "68.00", "45"); Vaccine createdVaccine = vaccineStorage.CreateVaccine(myVaccine); Assert.AreNotEqual( 0, createdVaccine.VaccineID, string.Format("Could not create Vaccine:{0}", createdVaccine.VaccineID)); myVaccine.VaccineQuantity = Convert.ToInt32("60"); vaccineStorage.UpdateVaccine(myVaccine); Vaccine updatedVaccine = vaccineStorage.ReadVaccine( createdVaccine.VaccineID); AssertVaccineItemEqual(myVaccine, updatedVaccine); }
public void InjectionMessageCreateSuccess() { IInjectionMessageStorage pInjectionMessageStorage = new InjectionMessageStorage(); IInjectorStorage pInjectorStorage = new InjectorStorage(); IVaccineStorage pVaccineStorage = new VaccineStorage(); int pgetInjectorID = getInjectorID(); int pgetVaccineID = getVaccineID(); InjectionMessage myInjectionMessage = CreateInjectionMessageForTest( pgetInjectorID, pInjectorStorage.ReadInjector(pgetInjectorID).InjectorName, pgetVaccineID, pVaccineStorage.ReadVaccine(pgetVaccineID).VaccineName, "某某人民医院", "2016-03-30", "陈医生"); InjectionMessage createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); Assert.AreNotEqual( 0, createdInjectionMessage.InjectionMessageID, string.Format("Could not create InjectionMessage:{0}", createdInjectionMessage.InjectionMessageID)); AssertInjectionMessageItemEqual(myInjectionMessage, createdInjectionMessage); }
private void btnSelect_Click(object sender, EventArgs e) { IList <InjectionMessage> injectionMessageList = new List <InjectionMessage>(); IInjectionMessageStorage injectionMessageStorage = new InjectionMessageStorage(); IInjectorStorage injectorStorage = new InjectorStorage(); IVaccineStorage vaccineStorage = new VaccineStorage(); QueryInjectionMessage queryInjectionMessage = new QueryInjectionMessage(); #region pspselect if (cmbInjectorName.Text.Trim() != "" && cmbVaccineName.Text.Trim() != "") { queryInjectionMessage.InjectorID = Convert.ToInt32(cmbInjectorName.SelectedValue.ToString()); queryInjectionMessage.VaccineID = Convert.ToInt32(cmbVaccineName.SelectedValue.ToString()); queryInjectionMessage.InjectionMessageSite = textInjectionMessageSite.Text.Trim(); queryInjectionMessage.InjectionMessageDoctor = textInjectionMessageDoctor.Text.Trim(); } else if (cmbInjectorName.Text.Trim() == "" && cmbVaccineName.Text.Trim() != "") { queryInjectionMessage.VaccineID = Convert.ToInt32(cmbVaccineName.SelectedValue.ToString()); queryInjectionMessage.InjectionMessageSite = textInjectionMessageSite.Text.Trim(); queryInjectionMessage.InjectionMessageDoctor = textInjectionMessageDoctor.Text.Trim(); } else if (cmbInjectorName.Text.Trim() != "" && cmbVaccineName.Text.Trim() == "") { queryInjectionMessage.InjectorID = Convert.ToInt32(cmbInjectorName.SelectedValue.ToString()); queryInjectionMessage.InjectionMessageSite = textInjectionMessageSite.Text.Trim(); queryInjectionMessage.InjectionMessageDoctor = textInjectionMessageDoctor.Text.Trim(); } else { queryInjectionMessage.InjectionMessageSite = textInjectionMessageSite.Text.Trim(); queryInjectionMessage.InjectionMessageDoctor = textInjectionMessageDoctor.Text.Trim(); } #endregion injectionMessageList = injectionMessageStorage.ListInjectionMessage(queryInjectionMessage); foreach (InjectionMessage injectionMessage in injectionMessageList) //对injectionMessageList数组遍历 { injectionMessage.InjectorName = (injectorStorage.ReadInjector(injectionMessage.InjectorID)).InjectorName; injectionMessage.VaccineName = (vaccineStorage.ReadVaccine(injectionMessage.VaccineID)).VaccineName; } dgvInjectionMessage.AutoGenerateColumns = true; dgvInjectionMessage.DataSource = injectionMessageList; dgvInjectionMessage.Columns[0].Visible = false; dgvInjectionMessage.Columns[1].Visible = false; dgvInjectionMessage.Columns[3].Visible = false; dgvInjectionMessage.Columns[2].Width = 130; dgvInjectionMessage.Columns[4].Width = 130; dgvInjectionMessage.Columns[5].Width = 130; dgvInjectionMessage.Columns[6].Width = 130; dgvInjectionMessage.Columns[7].Width = 130; }
public void VaccineReadFailureVaccineIdArgumentException() { IVaccineStorage vaccineStorage = new VaccineStorage(); // Vaccine myVaccine = CreateVaccineForTest( // "狂犬疫苗", // "处方", // getManufacturersIDtwo(), // "68.00", // "45"); // Vaccine createdVaccine = // vaccineStorage.CreateVaccine(myVaccine); vaccineStorage.ReadVaccine(-1); }
public void InjectionMessageCreateFailureInjectionMessageDoctorArgumentNullException() { IInjectionMessageStorage injectionMessageStorage = new InjectionMessageStorage(); IInjectorStorage pInjectorStorage = new InjectorStorage(); IVaccineStorage pVaccineStorage = new VaccineStorage(); int pgetInjectorID = getInjectorID(); int pgetVaccineID = getVaccineID(); InjectionMessage myInjectionMessage = CreateInjectionMessageForTest( pgetInjectorID, pInjectorStorage.ReadInjector(pgetInjectorID).InjectorName, pgetVaccineID, pVaccineStorage.ReadVaccine(pgetVaccineID).VaccineName, "某某人民医院", "2016-03-30", null); injectionMessageStorage.CreateInjectionMessage(myInjectionMessage); }
public void VaccineReadSuccess() { IVaccineStorage vaccineStorage = new VaccineStorage(); Vaccine myVaccine = CreateVaccineForTest( "狂犬疫苗", "处方", getManufacturersIDtwo(), "68.00", "45"); Vaccine createdVaccine = vaccineStorage.CreateVaccine(myVaccine); Assert.AreNotEqual( 0, createdVaccine.VaccineID, string.Format("Could not create Vaccine:{0}", createdVaccine.VaccineID)); Vaccine readedVaccine = vaccineStorage.ReadVaccine( createdVaccine.VaccineID); AssertVaccineItemEqual(createdVaccine, readedVaccine); }
public void InjectionMessageUpdateFailureInjectionMessageIdArgumentException() { IInjectionMessageStorage pInjectionMessageStorage = new InjectionMessageStorage(); IInjectorStorage pInjectorStorage = new InjectorStorage(); IVaccineStorage pVaccineStorage = new VaccineStorage(); int pgetInjectorID = getInjectorID(); int pgetVaccineID = getVaccineID(); InjectionMessage myInjectionMessage = CreateInjectionMessageForTest( pgetInjectorID, pInjectorStorage.ReadInjector(pgetInjectorID).InjectorName, pgetVaccineID, pVaccineStorage.ReadVaccine(pgetVaccineID).VaccineName, "某某人民医院", "2016-03-30", "陈医生"); pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); myInjectionMessage.InjectionMessageID = int.MaxValue; pInjectionMessageStorage.UpdateInjectionMessage(myInjectionMessage); }
public void InjectionMessageListSuccess() { List <InjectionMessage> injectionMessageList = new List <InjectionMessage>(); IInjectionMessageStorage pInjectionMessageStorage = new InjectionMessageStorage(); IInjectorStorage pInjectorStorage = new InjectorStorage(); IVaccineStorage pVaccineStorage = new VaccineStorage(); int pgetInjectorID = getInjectorID(); int pgetVaccineID = getVaccineID(); InjectionMessage myInjectionMessage = CreateInjectionMessageForTest( pgetInjectorID, pInjectorStorage.ReadInjector(pgetInjectorID).InjectorName, pgetVaccineID, pVaccineStorage.ReadVaccine(pgetVaccineID).VaccineName, "某某人民医院", "2016-03-30", "陈医生"); InjectionMessage createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); pgetInjectorID = getInjectorID(); myInjectionMessage = CreateInjectionMessageForTest( pgetInjectorID, pInjectorStorage.ReadInjector(pgetInjectorID).InjectorName, createdInjectionMessage.VaccineID, pVaccineStorage.ReadVaccine(createdInjectionMessage.VaccineID).VaccineName, "某某人民医院", "2016-03-30", "陈医生"); createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); pgetVaccineID = getVaccineID(); myInjectionMessage = CreateInjectionMessageForTest( createdInjectionMessage.InjectorID, pInjectorStorage.ReadInjector(createdInjectionMessage.InjectorID).InjectorName, pgetVaccineID, pVaccineStorage.ReadVaccine(pgetVaccineID).VaccineName, "某某人民医院", "2016-03-30", "陈医生"); createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); myInjectionMessage = CreateInjectionMessageForTest( createdInjectionMessage.InjectorID, pInjectorStorage.ReadInjector(createdInjectionMessage.InjectorID).InjectorName, createdInjectionMessage.VaccineID, pVaccineStorage.ReadVaccine(createdInjectionMessage.VaccineID).VaccineName, "海口市中医院", "2016-03-30", "陈医生"); createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); myInjectionMessage = CreateInjectionMessageForTest( createdInjectionMessage.InjectorID, pInjectorStorage.ReadInjector(createdInjectionMessage.InjectorID).InjectorName, createdInjectionMessage.VaccineID, pVaccineStorage.ReadVaccine(createdInjectionMessage.VaccineID).VaccineName, "海口市中医院", "2016-04-25", "陈医生"); createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); myInjectionMessage = CreateInjectionMessageForTest( createdInjectionMessage.InjectorID, pInjectorStorage.ReadInjector(createdInjectionMessage.InjectorID).InjectorName, createdInjectionMessage.VaccineID, pVaccineStorage.ReadVaccine(createdInjectionMessage.VaccineID).VaccineName, "海口市中医院", "2016-04-25", "欧阳医生"); createdInjectionMessage = pInjectionMessageStorage.CreateInjectionMessage(myInjectionMessage); injectionMessageList.Add(createdInjectionMessage); QueryInjectionMessage queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = null; queryInjectionMessage.VaccineID = null; queryInjectionMessage.InjectionMessageSite = null; queryInjectionMessage.InjectionMessageTime = null; queryInjectionMessage.InjectionMessageDoctor = null; IList <InjectionMessage> readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); injectionMessageList.RemoveAt(0); queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = createdInjectionMessage.InjectorID; queryInjectionMessage.VaccineID = null; queryInjectionMessage.InjectionMessageSite = null; queryInjectionMessage.InjectionMessageTime = null; queryInjectionMessage.InjectionMessageDoctor = null; readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); injectionMessageList.RemoveAt(0); queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = null; queryInjectionMessage.VaccineID = createdInjectionMessage.VaccineID; queryInjectionMessage.InjectionMessageSite = null; queryInjectionMessage.InjectionMessageTime = null; queryInjectionMessage.InjectionMessageDoctor = null; readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); injectionMessageList.RemoveAt(0); queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = null; queryInjectionMessage.VaccineID = null; queryInjectionMessage.InjectionMessageSite = "海口市中医院"; queryInjectionMessage.InjectionMessageTime = null; queryInjectionMessage.InjectionMessageDoctor = null; readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); injectionMessageList.RemoveAt(0); queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = null; queryInjectionMessage.VaccineID = null; queryInjectionMessage.InjectionMessageSite = null; queryInjectionMessage.InjectionMessageTime = Convert.ToDateTime("2016-04-25"); queryInjectionMessage.InjectionMessageDoctor = null; readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); injectionMessageList.RemoveAt(0); queryInjectionMessage = new QueryInjectionMessage(); queryInjectionMessage.InjectionMessageID = null; queryInjectionMessage.InjectorID = null; queryInjectionMessage.VaccineID = null; queryInjectionMessage.InjectionMessageSite = null; queryInjectionMessage.InjectionMessageTime = null; queryInjectionMessage.InjectionMessageDoctor = "欧阳医生"; readedInjectionMessageList = pInjectionMessageStorage.ListInjectionMessage(queryInjectionMessage); AssertInjectionMessageListsEqual(injectionMessageList, readedInjectionMessageList); }