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); }
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 InjectorReadFailureInjectorIdArgumentException() { IInjectorStorage injectorStorage = new InjectorStorage(); // Injector myInjector = CreateInjectorForTest( // "王某某", // "女", // "17733441111", // "2", // "2013-07-09"); // Injector createdInjector = // injectorStorage.CreateInjector(myInjector); injectorStorage.ReadInjector(-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 InjectorReadSuccess() { IInjectorStorage injectorStorage = new InjectorStorage(); Injector myInjector = CreateInjectorForTest( "王某某", "女", "17733441111", "2", "2013-07-09"); Injector createdInjector = injectorStorage.CreateInjector(myInjector); Assert.AreNotEqual( 0, createdInjector.InjectorID, string.Format("Could not create Injector:{0}", createdInjector.InjectorID)); Injector readedInjector = injectorStorage.ReadInjector( createdInjector.InjectorID); AssertInjectorItemEqual(createdInjector, readedInjector); }
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); }