/// <summary> /// Deep load all AwBuildVersion children. /// </summary> private void Step_03_DeepLoad_Generated() { using (TransactionManager tm = CreateTransaction()) { int count = -1; mock = CreateMockInstance(tm); mockCollection = DataRepository.AwBuildVersionProvider.GetPaged(tm, 0, 10, out count); DataRepository.AwBuildVersionProvider.DeepLoading += new EntityProviderBaseCore <AwBuildVersion, AwBuildVersionKey> .DeepLoadingEventHandler( delegate(object sender, DeepSessionEventArgs e) { if (e.DeepSession.Count > 3) { e.Cancel = true; } } ); if (mockCollection.Count > 0) { DataRepository.AwBuildVersionProvider.DeepLoad(tm, mockCollection[0]); System.Console.WriteLine("AwBuildVersion instance correctly deep loaded at 1 level."); mockCollection.Add(mock); // DataRepository.AwBuildVersionProvider.DeepSave(tm, mockCollection); } //normally one would commit here //tm.Commit(); //IDisposable will Rollback Transaction since it's left uncommitted } }
///<summary> /// Update the Typed AwBuildVersion Entity with modified mock values. ///</summary> static public void UpdateMockInstance(TransactionManager tm, AwBuildVersion mock) { AwBuildVersionTest.UpdateMockInstance_Generated(tm, mock); // make any alterations necessary // (i.e. for DB check constraints, special test cases, etc.) SetSpecialTestData(mock); }
/// <summary> /// Check the foreign key dal methods. /// </summary> private void Step_10_FK_Generated() { using (TransactionManager tm = CreateTransaction()) { AwBuildVersion entity = CreateMockInstance(tm); bool result = DataRepository.AwBuildVersionProvider.Insert(tm, entity); Assert.IsTrue(result, "Could Not Test FK, Insert Failed"); } }
/// <summary> /// Test methods exposed by the EntityHelper class. /// </summary> private void Step_20_TestEntityHelper_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); AwBuildVersion entity = mock.Copy() as AwBuildVersion; entity = (AwBuildVersion)mock.Clone(); Assert.IsTrue(AwBuildVersion.ValueEquals(entity, mock), "Clone is not working"); } }
///<summary> /// Returns a Typed AwBuildVersion Entity with mock values. ///</summary> static public AwBuildVersion CreateMockInstance(TransactionManager tm) { // get the default mock instance AwBuildVersion mock = AwBuildVersionTest.CreateMockInstance_Generated(tm); // make any alterations necessary // (i.e. for DB check constraints, special test cases, etc.) SetSpecialTestData(mock); // return the modified object return(mock); }
/// <summary> /// Check the indexes dal methods. /// </summary> private void Step_11_IX_Generated() { using (TransactionManager tm = CreateTransaction()) { AwBuildVersion entity = CreateMockInstance(tm); bool result = DataRepository.AwBuildVersionProvider.Insert(tm, entity); Assert.IsTrue(result, "Could Not Test IX, Insert Failed"); AwBuildVersion t0 = DataRepository.AwBuildVersionProvider.GetBySystemInformationId(tm, entity.SystemInformationId); } }
/// <summary> /// Serialize the mock AwBuildVersion 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_AwBuildVersion.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> /// Inserts a mock AwBuildVersion entity into the database. /// </summary> private void Step_01_Insert_Generated() { using (TransactionManager tm = CreateTransaction()) { mock = CreateMockInstance(tm); Assert.IsTrue(DataRepository.AwBuildVersionProvider.Insert(tm, mock), "Insert failed"); System.Console.WriteLine("DataRepository.AwBuildVersionProvider.Insert(mock):"); System.Console.WriteLine(mock); //normally one would commit here //tm.Commit(); //IDisposable will Rollback Transaction since it's left uncommitted } }
/// <summary> /// Serialize a AwBuildVersion 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_AwBuildVersionCollection.xml"); mock = CreateMockInstance(tm); TList <AwBuildVersion> mockCollection = new TList <AwBuildVersion>(); mockCollection.Add(mock); EntityHelper.SerializeXml(mockCollection, fileName); Assert.IsTrue(System.IO.File.Exists(fileName), "Serialized mock collection not found"); System.Console.WriteLine("TList<AwBuildVersion> correctly serialized to a temporary file."); } }
///<summary> /// Returns a Typed AwBuildVersion Entity with mock values. ///</summary> static public AwBuildVersion CreateMockInstance_Generated(TransactionManager tm) { AwBuildVersion mock = new AwBuildVersion(); mock.DatabaseVersion = TestUtility.Instance.RandomString(11, false);; mock.VersionDate = TestUtility.Instance.RandomDateTime(); mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); // create a temporary collection and add the item to it TList <AwBuildVersion> tempMockCollection = new TList <AwBuildVersion>(); tempMockCollection.Add(mock); tempMockCollection.Remove(mock); return((AwBuildVersion)mock); }
/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance AwBuildVersion mock = CreateMockInstance(tm); bool result = DataRepository.AwBuildVersionProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); AwBuildVersionQuery query = new AwBuildVersionQuery(); query.AppendEquals(AwBuildVersionColumn.SystemInformationId, mock.SystemInformationId.ToString()); query.AppendEquals(AwBuildVersionColumn.DatabaseVersion, mock.DatabaseVersion.ToString()); query.AppendEquals(AwBuildVersionColumn.VersionDate, mock.VersionDate.ToString()); query.AppendEquals(AwBuildVersionColumn.ModifiedDate, mock.ModifiedDate.ToString()); TList <AwBuildVersion> results = DataRepository.AwBuildVersionProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }
/// <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(AwBuildVersion mock) { //Code your changes to the data object here. }
///<summary> /// Update the Typed AwBuildVersion Entity with modified mock values. ///</summary> static public void UpdateMockInstance_Generated(TransactionManager tm, AwBuildVersion mock) { mock.DatabaseVersion = TestUtility.Instance.RandomString(11, false);; mock.VersionDate = TestUtility.Instance.RandomDateTime(); mock.ModifiedDate = TestUtility.Instance.RandomDateTime(); }