/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance StudentMasterIndex mock = CreateMockInstance(tm); bool result = DataRepository.StudentMasterIndexProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); StudentMasterIndexQuery query = new StudentMasterIndexQuery(); query.AppendEquals(StudentMasterIndexColumn.StudentId, mock.StudentId.ToString()); if (mock.EpassId != null) { query.AppendEquals(StudentMasterIndexColumn.EpassId, mock.EpassId.ToString()); } if (mock.StudentUpn != null) { query.AppendEquals(StudentMasterIndexColumn.StudentUpn, mock.StudentUpn.ToString()); } if (mock.SsabsaId != null) { query.AppendEquals(StudentMasterIndexColumn.SsabsaId, mock.SsabsaId.ToString()); } if (mock.Surname != null) { query.AppendEquals(StudentMasterIndexColumn.Surname, mock.Surname.ToString()); } if (mock.FirstName != null) { query.AppendEquals(StudentMasterIndexColumn.FirstName, mock.FirstName.ToString()); } if (mock.OtherNames != null) { query.AppendEquals(StudentMasterIndexColumn.OtherNames, mock.OtherNames.ToString()); } if (mock.KnownName != null) { query.AppendEquals(StudentMasterIndexColumn.KnownName, mock.KnownName.ToString()); } if (mock.LegalName != null) { query.AppendEquals(StudentMasterIndexColumn.LegalName, mock.LegalName.ToString()); } if (mock.Dob != null) { query.AppendEquals(StudentMasterIndexColumn.Dob, mock.Dob.ToString()); } if (mock.Gender != null) { query.AppendEquals(StudentMasterIndexColumn.Gender, mock.Gender.ToString()); } if (mock.IndigeneousStatus != null) { query.AppendEquals(StudentMasterIndexColumn.IndigeneousStatus, mock.IndigeneousStatus.ToString()); } if (mock.Lbote != null) { query.AppendEquals(StudentMasterIndexColumn.Lbote, mock.Lbote.ToString()); } if (mock.EslPhase != null) { query.AppendEquals(StudentMasterIndexColumn.EslPhase, mock.EslPhase.ToString()); } if (mock.TribalGroup != null) { query.AppendEquals(StudentMasterIndexColumn.TribalGroup, mock.TribalGroup.ToString()); } if (mock.SlpCreatedFlag != null) { query.AppendEquals(StudentMasterIndexColumn.SlpCreatedFlag, mock.SlpCreatedFlag.ToString()); } if (mock.AddressLine1 != null) { query.AppendEquals(StudentMasterIndexColumn.AddressLine1, mock.AddressLine1.ToString()); } if (mock.AddressLine2 != null) { query.AppendEquals(StudentMasterIndexColumn.AddressLine2, mock.AddressLine2.ToString()); } if (mock.AddressLine3 != null) { query.AppendEquals(StudentMasterIndexColumn.AddressLine3, mock.AddressLine3.ToString()); } if (mock.AddressLine4 != null) { query.AppendEquals(StudentMasterIndexColumn.AddressLine4, mock.AddressLine4.ToString()); } if (mock.Suburb != null) { query.AppendEquals(StudentMasterIndexColumn.Suburb, mock.Suburb.ToString()); } if (mock.Postcode != null) { query.AppendEquals(StudentMasterIndexColumn.Postcode, mock.Postcode.ToString()); } if (mock.Phone1 != null) { query.AppendEquals(StudentMasterIndexColumn.Phone1, mock.Phone1.ToString()); } if (mock.Phone2 != null) { query.AppendEquals(StudentMasterIndexColumn.Phone2, mock.Phone2.ToString()); } if (mock.SourceSystem != null) { query.AppendEquals(StudentMasterIndexColumn.SourceSystem, mock.SourceSystem.ToString()); } if (mock.PhoneticMatchId != null) { query.AppendEquals(StudentMasterIndexColumn.PhoneticMatchId, mock.PhoneticMatchId.ToString()); } TList <StudentMasterIndex> results = DataRepository.StudentMasterIndexProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }
/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance StudentMasterIndex mock = CreateMockInstance(tm); bool result = DataRepository.StudentMasterIndexProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); StudentMasterIndexQuery query = new StudentMasterIndexQuery(); query.AppendEquals(StudentMasterIndexColumn.StudentId, mock.StudentId.ToString()); if(mock.EpassId != null) query.AppendEquals(StudentMasterIndexColumn.EpassId, mock.EpassId.ToString()); if(mock.StudentUpn != null) query.AppendEquals(StudentMasterIndexColumn.StudentUpn, mock.StudentUpn.ToString()); if(mock.SsabsaId != null) query.AppendEquals(StudentMasterIndexColumn.SsabsaId, mock.SsabsaId.ToString()); if(mock.Surname != null) query.AppendEquals(StudentMasterIndexColumn.Surname, mock.Surname.ToString()); if(mock.FirstName != null) query.AppendEquals(StudentMasterIndexColumn.FirstName, mock.FirstName.ToString()); if(mock.OtherNames != null) query.AppendEquals(StudentMasterIndexColumn.OtherNames, mock.OtherNames.ToString()); if(mock.KnownName != null) query.AppendEquals(StudentMasterIndexColumn.KnownName, mock.KnownName.ToString()); if(mock.LegalName != null) query.AppendEquals(StudentMasterIndexColumn.LegalName, mock.LegalName.ToString()); if(mock.Dob != null) query.AppendEquals(StudentMasterIndexColumn.Dob, mock.Dob.ToString()); if(mock.Gender != null) query.AppendEquals(StudentMasterIndexColumn.Gender, mock.Gender.ToString()); if(mock.IndigeneousStatus != null) query.AppendEquals(StudentMasterIndexColumn.IndigeneousStatus, mock.IndigeneousStatus.ToString()); if(mock.Lbote != null) query.AppendEquals(StudentMasterIndexColumn.Lbote, mock.Lbote.ToString()); if(mock.EslPhase != null) query.AppendEquals(StudentMasterIndexColumn.EslPhase, mock.EslPhase.ToString()); if(mock.TribalGroup != null) query.AppendEquals(StudentMasterIndexColumn.TribalGroup, mock.TribalGroup.ToString()); if(mock.SlpCreatedFlag != null) query.AppendEquals(StudentMasterIndexColumn.SlpCreatedFlag, mock.SlpCreatedFlag.ToString()); if(mock.AddressLine1 != null) query.AppendEquals(StudentMasterIndexColumn.AddressLine1, mock.AddressLine1.ToString()); if(mock.AddressLine2 != null) query.AppendEquals(StudentMasterIndexColumn.AddressLine2, mock.AddressLine2.ToString()); if(mock.AddressLine3 != null) query.AppendEquals(StudentMasterIndexColumn.AddressLine3, mock.AddressLine3.ToString()); if(mock.AddressLine4 != null) query.AppendEquals(StudentMasterIndexColumn.AddressLine4, mock.AddressLine4.ToString()); if(mock.Suburb != null) query.AppendEquals(StudentMasterIndexColumn.Suburb, mock.Suburb.ToString()); if(mock.Postcode != null) query.AppendEquals(StudentMasterIndexColumn.Postcode, mock.Postcode.ToString()); if(mock.Phone1 != null) query.AppendEquals(StudentMasterIndexColumn.Phone1, mock.Phone1.ToString()); if(mock.Phone2 != null) query.AppendEquals(StudentMasterIndexColumn.Phone2, mock.Phone2.ToString()); if(mock.SourceSystem != null) query.AppendEquals(StudentMasterIndexColumn.SourceSystem, mock.SourceSystem.ToString()); if(mock.PhoneticMatchId != null) query.AppendEquals(StudentMasterIndexColumn.PhoneticMatchId, mock.PhoneticMatchId.ToString()); TList<StudentMasterIndex> results = DataRepository.StudentMasterIndexProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }