/// <summary> /// Test Find using the Query class /// </summary> private void Step_30_TestFindByQuery_Generated() { using (TransactionManager tm = CreateTransaction()) { //Insert Mock Instance Store mock = CreateMockInstance(tm); bool result = DataRepository.StoreProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); StoreQuery query = new StoreQuery(); query.AppendEquals(StoreColumn.CustomerId, mock.CustomerId.ToString()); query.AppendEquals(StoreColumn.Name, mock.Name.ToString()); if (mock.SalesPersonId != null) { query.AppendEquals(StoreColumn.SalesPersonId, mock.SalesPersonId.ToString()); } query.AppendEquals(StoreColumn.Rowguid, mock.Rowguid.ToString()); query.AppendEquals(StoreColumn.ModifiedDate, mock.ModifiedDate.ToString()); TList <Store> results = DataRepository.StoreProvider.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 Store mock = CreateMockInstance(tm); bool result = DataRepository.StoreProvider.Insert(tm, mock); Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed"); StoreQuery query = new StoreQuery(); query.AppendEquals(StoreColumn.Id, mock.Id.ToString()); if (mock.Type != null) { query.AppendEquals(StoreColumn.Type, mock.Type.ToString()); } if (mock.Name != null) { query.AppendEquals(StoreColumn.Name, mock.Name.ToString()); } if (mock.Fullname != null) { query.AppendEquals(StoreColumn.Fullname, mock.Fullname.ToString()); } if (mock.Address != null) { query.AppendEquals(StoreColumn.Address, mock.Address.ToString()); } if (mock.Phone != null) { query.AppendEquals(StoreColumn.Phone, mock.Phone.ToString()); } if (mock.Fax != null) { query.AppendEquals(StoreColumn.Fax, mock.Fax.ToString()); } if (mock.Bankname != null) { query.AppendEquals(StoreColumn.Bankname, mock.Bankname.ToString()); } if (mock.BankBr != null) { query.AppendEquals(StoreColumn.BankBr, mock.BankBr.ToString()); } if (mock.Accnum != null) { query.AppendEquals(StoreColumn.Accnum, mock.Accnum.ToString()); } if (mock.Vatnum != null) { query.AppendEquals(StoreColumn.Vatnum, mock.Vatnum.ToString()); } if (mock.Contactps != null) { query.AppendEquals(StoreColumn.Contactps, mock.Contactps.ToString()); } if (mock.Remark != null) { query.AppendEquals(StoreColumn.Remark, mock.Remark.ToString()); } if (mock.OpenDate != null) { query.AppendEquals(StoreColumn.OpenDate, mock.OpenDate.ToString()); } query.AppendEquals(StoreColumn.Status, mock.Status.ToString()); TList <Store> results = DataRepository.StoreProvider.Find(tm, query); Assert.IsTrue(results.Count == 1, "Find is not working correctly. Failed to find the mock instance"); } }