/// <summary> /// Convert a nettiers entity to the ws proxy entity. /// </summary> public static WsProxy.StudentMasterIndex Convert(Nettiers.AdventureWorks.Entities.StudentMasterIndex item) { WsProxy.StudentMasterIndex outItem = new WsProxy.StudentMasterIndex(); outItem.StudentId = item.StudentId; outItem.EpassId = item.EpassId; outItem.StudentUpn = item.StudentUpn; outItem.SsabsaId = item.SsabsaId; outItem.Surname = item.Surname; outItem.FirstName = item.FirstName; outItem.OtherNames = item.OtherNames; outItem.KnownName = item.KnownName; outItem.LegalName = item.LegalName; outItem.Dob = item.Dob; outItem.Gender = item.Gender; outItem.IndigeneousStatus = item.IndigeneousStatus; outItem.Lbote = item.Lbote; outItem.EslPhase = item.EslPhase; outItem.TribalGroup = item.TribalGroup; outItem.SlpCreatedFlag = item.SlpCreatedFlag; outItem.AddressLine1 = item.AddressLine1; outItem.AddressLine2 = item.AddressLine2; outItem.AddressLine3 = item.AddressLine3; outItem.AddressLine4 = item.AddressLine4; outItem.Suburb = item.Suburb; outItem.Postcode = item.Postcode; outItem.Phone1 = item.Phone1; outItem.Phone2 = item.Phone2; outItem.SourceSystem = item.SourceSystem; outItem.PhoneticMatchId = item.PhoneticMatchId; outItem.OriginalStudentId = item.OriginalStudentId; return(outItem); }
/// <summary> /// Inserts a mock StudentMasterIndex entity into the database. /// </summary> private void Step_01_Insert_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); Assert.IsTrue(DataRepository.StudentMasterIndexProvider.Insert(tm, mock), "Insert failed"); System.Console.WriteLine("DataRepository.StudentMasterIndexProvider.Insert(mock):"); System.Console.WriteLine(mock); //normally one would commit here //tm.Commit(); //IDisposable will Rollback Transaction since it's left uncommitted } }
/// <summary> /// Inserts a Nettiers.AdventureWorks.Entities.StudentMasterIndex object into the datasource using a transaction. /// </summary> /// <param name="transactionManager"><see cref="TransactionManager"/> object</param> /// <param name="entity">Nettiers.AdventureWorks.Entities.StudentMasterIndex object to insert.</param> /// <remarks></remarks> /// <returns>Returns true if operation is successful.</returns> public override bool Insert(TransactionManager transactionManager, Nettiers.AdventureWorks.Entities.StudentMasterIndex entity) { WsProxy.AdventureWorksServices proxy = new WsProxy.AdventureWorksServices(); proxy.Url = Url; try { WsProxy.StudentMasterIndex result = proxy.StudentMasterIndexProvider_Insert(Convert(entity)); Convert(entity, result); return(true); } catch (SoapException soex) { System.Diagnostics.Debug.WriteLine(soex); throw soex; } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex); throw ex; } }
/// <summary> /// Convert a nettiers collection to the ws proxy collection. /// </summary> public static Nettiers.AdventureWorks.Entities.StudentMasterIndex Convert(WsProxy.StudentMasterIndex item) { Nettiers.AdventureWorks.Entities.StudentMasterIndex outItem = item == null ? null : new Nettiers.AdventureWorks.Entities.StudentMasterIndex(); Convert(outItem, item); return(outItem); }
/// <summary> /// Make any alterations necessary (i.e. for DB check constraints, special test cases, etc.) /// </summary> /// <param name="mock">Object to be modified</param> static private void SetSpecialTestData(StudentMasterIndex mock) { //Code your changes to the data object here. }
///<summary> /// Update the Typed StudentMasterIndex Entity with modified mock values. ///</summary> static public void UpdateMockInstance(TransactionManager tm, StudentMasterIndex mock) { StudentMasterIndexTest.UpdateMockInstance_Generated(tm, mock); // make any alterations necessary // (i.e. for DB check constraints, special test cases, etc.) SetSpecialTestData(mock); }
///<summary> /// Update the Typed StudentMasterIndex Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, StudentMasterIndex mock) { mock.EpassId = TestUtility.Instance.RandomString(24, false);; mock.StudentUpn = TestUtility.Instance.RandomString(13, false);; mock.SsabsaId = TestUtility.Instance.RandomString(49, false);; mock.Surname = TestUtility.Instance.RandomString(14, false);; mock.FirstName = TestUtility.Instance.RandomString(11, false);; mock.OtherNames = TestUtility.Instance.RandomString(24, false);; mock.KnownName = TestUtility.Instance.RandomString(11, false);; mock.LegalName = TestUtility.Instance.RandomString(14, false);; mock.Dob = TestUtility.Instance.RandomDateTime(); mock.Gender = TestUtility.Instance.RandomString(6, false);; mock.IndigeneousStatus = TestUtility.Instance.RandomString(19, false);; mock.Lbote = TestUtility.Instance.RandomString(3, false);; mock.EslPhase = TestUtility.Instance.RandomString(11, false);; mock.TribalGroup = TestUtility.Instance.RandomString(24, false);; mock.SlpCreatedFlag = TestUtility.Instance.RandomString(3, false);; mock.AddressLine1 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine2 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine3 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine4 = TestUtility.Instance.RandomString(24, false);; mock.Suburb = TestUtility.Instance.RandomString(24, false);; mock.Postcode = TestUtility.Instance.RandomString(4, false);; mock.Phone1 = TestUtility.Instance.RandomString(10, false);; mock.Phone2 = TestUtility.Instance.RandomString(10, false);; mock.SourceSystem = TestUtility.Instance.RandomString(11, false);; mock.PhoneticMatchId = TestUtility.Instance.RandomNumber(); }
///<summary> /// Returns a Typed StudentMasterIndex Entity with mock values. ///</summary> static public StudentMasterIndex CreateMockInstance_Generated(TransactionManager tm) { StudentMasterIndex mock = new StudentMasterIndex(); mock.StudentId = TestUtility.Instance.RandomNumber(); mock.EpassId = TestUtility.Instance.RandomString(24, false);; mock.StudentUpn = TestUtility.Instance.RandomString(13, false);; mock.SsabsaId = TestUtility.Instance.RandomString(49, false);; mock.Surname = TestUtility.Instance.RandomString(14, false);; mock.FirstName = TestUtility.Instance.RandomString(11, false);; mock.OtherNames = TestUtility.Instance.RandomString(24, false);; mock.KnownName = TestUtility.Instance.RandomString(11, false);; mock.LegalName = TestUtility.Instance.RandomString(14, false);; mock.Dob = TestUtility.Instance.RandomDateTime(); mock.Gender = TestUtility.Instance.RandomString(6, false);; mock.IndigeneousStatus = TestUtility.Instance.RandomString(19, false);; mock.Lbote = TestUtility.Instance.RandomString(3, false);; mock.EslPhase = TestUtility.Instance.RandomString(11, false);; mock.TribalGroup = TestUtility.Instance.RandomString(24, false);; mock.SlpCreatedFlag = TestUtility.Instance.RandomString(3, false);; mock.AddressLine1 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine2 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine3 = TestUtility.Instance.RandomString(24, false);; mock.AddressLine4 = TestUtility.Instance.RandomString(24, false);; mock.Suburb = TestUtility.Instance.RandomString(24, false);; mock.Postcode = TestUtility.Instance.RandomString(4, false);; mock.Phone1 = TestUtility.Instance.RandomString(10, false);; mock.Phone2 = TestUtility.Instance.RandomString(10, false);; mock.SourceSystem = TestUtility.Instance.RandomString(11, false);; mock.PhoneticMatchId = TestUtility.Instance.RandomNumber(); // create a temporary collection and add the item to it TList<StudentMasterIndex> tempMockCollection = new TList<StudentMasterIndex>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return (StudentMasterIndex)mock; }
/// <summary> /// Test methods exposed by the EntityHelper class. /// </summary> private void Step_20_TestEntityHelper_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); StudentMasterIndex entity = mock.Copy() as StudentMasterIndex; entity = (StudentMasterIndex)mock.Clone(); Assert.IsTrue(StudentMasterIndex.ValueEquals(entity, mock), "Clone is not working"); } }
/// <summary> /// Serialize a StudentMasterIndex collection into a temporary file. /// </summary> private void Step_08_SerializeCollection_Generated() { using (TransactionManager tm = CreateTransaction()) { string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_StudentMasterIndexCollection.xml"); mock = CreateMockInstance(tm); TList<StudentMasterIndex> mockCollection = new TList<StudentMasterIndex>(); mockCollection.Add(mock); EntityHelper.SerializeXml(mockCollection, fileName); Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found"); System.Console.WriteLine("TList<StudentMasterIndex> correctly serialized to a temporary file."); } }
/// <summary> /// Serialize the mock StudentMasterIndex entity into a temporary file. /// </summary> private void Step_06_SerializeEntity_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); string fileName = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "temp_StudentMasterIndex.xml"); EntityHelper.SerializeXml(mock, fileName); Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock not found"); System.Console.WriteLine("mock correctly serialized to a temporary file."); } }
/// <summary> /// Deep load all StudentMasterIndex children. /// </summary> private void Step_03_DeepLoad_Generated() { using (TransactionManager tm = CreateTransaction()) { int count = -1; mock = CreateMockInstance(tm); mockCollection = DataRepository.StudentMasterIndexProvider.GetPaged(tm, 0, 10, out count); DataRepository.StudentMasterIndexProvider.DeepLoading += new EntityProviderBaseCore<StudentMasterIndex, StudentMasterIndexKey>.DeepLoadingEventHandler( delegate(object sender, DeepSessionEventArgs e) { if (e.DeepSession.Count > 3) e.Cancel = true; } ); if (mockCollection.Count > 0) { DataRepository.StudentMasterIndexProvider.DeepLoad(tm, mockCollection[0]); System.Console.WriteLine("StudentMasterIndex instance correctly deep loaded at 1 level."); mockCollection.Add(mock); // DataRepository.StudentMasterIndexProvider.DeepSave(tm, mockCollection); } //normally one would commit here //tm.Commit(); //IDisposable will Rollback Transaction since it's left uncommitted } }