public void Cash_paymentTest() { #region [Insert] Cash_payment obj = new Cash_payment() { Cash_payment_id = "", Order_id = "1", Payment_date = "'2020-08-10'", Ledger_id = "1", Purpose = "00", Party_id = "1", Payment_amount = "1.03", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CCash_payment.Insert(obj, new DAL()); #endregion [Insert] #region [search names & pkid] Cash_payment obj1 = CCash_payment_exten.SearchName(obj.Cash_payment_name, new DAL()); Cash_payment obj2 = CCash_payment_exten.PKId(obj1.Cash_payment_id, new DAL()); Assert.AreEqual(obj.Order_id, obj2.Order_id); Assert.AreEqual(obj.Payment_date, obj2.Payment_date); Assert.AreEqual(obj.Ledger_id, obj2.Ledger_id); Assert.AreEqual(obj.Purpose, obj2.Purpose); Assert.AreEqual(obj.Party_id, obj2.Party_id); Assert.AreEqual(obj.Payment_amount, obj2.Payment_amount); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [search names & pkid] #region [Update] obj.Cash_payment_id = obj2.Cash_payment_id; obj.Order_id = "00"; obj.Payment_date = "'2020-08-10'"; obj.Ledger_id = "00"; obj.Purpose = "00"; obj.Party_id = "00"; obj.Payment_amount = "1.23"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CCash_payment.Update(obj, new DAL()); obj1 = CCash_payment_exten.SearchName(obj.Cash_payment_name, new DAL()); obj2 = CCash_payment_exten.PKId(obj1.Cash_payment_id, new DAL()); Assert.AreEqual(obj.Cash_payment_id, obj2.Cash_payment_id); Assert.AreEqual(obj.Order_id, obj2.Order_id); Assert.AreEqual(obj.Payment_date, obj2.Payment_date); Assert.AreEqual(obj.Ledger_id, obj2.Ledger_id); Assert.AreEqual(obj.Purpose, obj2.Purpose); Assert.AreEqual(obj.Party_id, obj2.Party_id); Assert.AreEqual(obj.Payment_amount, obj2.Payment_amount); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [Update] #region [delete] CCash_payment.Delete(obj.Cash_payment_id, new DAL()); obj2 = CCash_payment_exten.PKId(obj1.Cash_payment_id, new DAL()); Assert.AreEqual(null, obj2.Cash_payment_id); #endregion [delete] #region [active] obj = new Cash_payment() { Cash_payment_id = "", Order_id = "00", Payment_date = "'2020-08-10'", Ledger_id = "00", Purpose = "00", Party_id = "00", Payment_amount = "1.23", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CCash_payment.Insert(obj, new DAL()); obj1 = CCash_payment_exten.SearchName(obj.Cash_payment_name, new DAL()); obj2 = CCash_payment_exten.PKId(obj1.Cash_payment_id, new DAL()); List <Cash_payment> list = CCash_payment_exten.Active(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, list[i].Active_id); } } #endregion [Active] #region [Not Active] obj.Cash_payment_id = obj1.Cash_payment_id; obj.Order_id = "00"; obj.Payment_date = "'2020-08-10'"; obj.Ledger_id = "00"; obj.Purpose = "00"; obj.Party_id = "00"; obj.Payment_amount = "1.23"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CCash_payment.Update(obj, new DAL()); list = CCash_payment_exten.NotActive(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.NotActive, list[i].Active_id); } } #endregion [Not Active] #region [Lookup] obj.Cash_payment_id = obj1.Cash_payment_id; obj.Order_id = "00"; obj.Payment_date = "'2020-08-10'"; obj.Ledger_id = "00"; obj.Purpose = "00"; obj.Party_id = "00"; obj.Payment_amount = "1.25"; obj.Notes = "test notes"; obj.Active_id = Core.Active; obj.User_id = Current.Codexsun; CCash_payment.Update(obj, new DAL()); DataTable tbl = CCash_payment_exten.GetforLookup(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, (tbl.Rows[i][COUNTRY.ACTIVE_ID]) + ""); } } #endregion [Lookup] #region [Get id name] Assert.AreEqual(CCash_payment_exten.GetId_Name(obj.Cash_payment_name), obj.Cash_payment_id + ""); Assert.AreEqual(CCash_payment_exten.GetName_Id(obj.Cash_payment_id), obj.Cash_payment_name + ""); CCash_payment.Delete(obj.Cash_payment_id, new DAL()); #endregion [Get id name] }
public void VersionTest() { #region [Insert] Version obj = new Version() { Version_id = "", Version_name = "00", Created_on = "'2020-08-10'", Changes = "00", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CVersion.Insert(obj, new DAL()); #endregion [Insert] #region [search names & pkid] Version obj1 = CVersion_exten.SearchName(obj.Version_name, new DAL()); Version obj2 = CVersion_exten.PKId(obj1.Version_id, new DAL()); Assert.AreEqual(obj.Version_name, obj2.Version_name); Assert.AreEqual(obj.Created_on, obj2.Created_on); Assert.AreEqual(obj.Changes, obj2.Changes); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [search names & pkid] #region [Update] obj.Version_id = obj2.Version_id; obj.Version_name = "00"; obj.Created_on = "'2020-08-10'"; obj.Changes = "00"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CVersion.Update(obj, new DAL()); obj1 = CVersion_exten.SearchName(obj.Version_name, new DAL()); obj2 = CVersion_exten.PKId(obj1.Version_id, new DAL()); Assert.AreEqual(obj.Version_id, obj2.Version_id); Assert.AreEqual(obj.Version_name, obj2.Version_name); Assert.AreEqual(obj.Created_on, obj2.Created_on); Assert.AreEqual(obj.Changes, obj2.Changes); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [Update] #region [delete] CVersion.Delete(obj.Version_id, new DAL()); obj2 = CVersion_exten.PKId(obj1.Version_id, new DAL()); Assert.AreEqual(null, obj2.Version_id); #endregion [delete] #region [active] obj = new Version() { Version_id = "", Version_name = "00", Created_on = "'2020-08-10'", Changes = "00", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CVersion.Insert(obj, new DAL()); obj1 = CVersion_exten.SearchName(obj.Version_name, new DAL()); obj2 = CVersion_exten.PKId(obj1.Version_id, new DAL()); List <Version> list = CVersion_exten.Active(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, list[i].Active_id); } } #endregion [Active] #region [Not Active] obj.Version_id = obj1.Version_id; obj.Version_name = "00"; obj.Created_on = "'2020-08-10'"; obj.Changes = "00"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CVersion.Update(obj, new DAL()); list = CVersion_exten.NotActive(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.NotActive, list[i].Active_id); } } #endregion [Not Active] #region [Lookup] obj.Version_id = obj1.Version_id; obj.Version_name = "00"; obj.Created_on = "'2020-08-10'"; obj.Changes = "00"; obj.Notes = "test notes"; obj.Active_id = Core.Active; obj.User_id = Current.Codexsun; CVersion.Update(obj, new DAL()); DataTable tbl = CVersion_exten.GetforLookup(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, (tbl.Rows[i][COUNTRY.ACTIVE_ID]) + ""); } } #endregion [Lookup] #region [Get id name] Assert.AreEqual(CVersion_exten.GetId_Name(obj.Version_name), obj.Version_id + ""); Assert.AreEqual(CVersion_exten.GetName_Id(obj.Version_id), obj.Version_name + ""); CVersion.Delete(obj.Version_id, new DAL()); #endregion [Get id name] }
public void AcyTest() { #region [Insert] Acy obj = new Acy() { Acy_id = "", Acy_name = "00", From_date = "'2020-08-07'", To_date = "'2020-08-07'", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CAcy.Insert(obj, new DAL()); #endregion [Insert] #region [search names & pkid] Acy obj1 = CAcy_exten.SearchName(obj.Acy_name, new DAL()); Acy obj2 = CAcy_exten.PKId(obj1.Acy_id, new DAL()); Assert.AreEqual(obj.Acy_name, obj2.Acy_name); Assert.AreEqual(obj.From_date, obj2.From_date); Assert.AreEqual(obj.To_date, obj2.To_date); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [search names & pkid] #region [Update] obj.Acy_id = obj2.Acy_id; obj.Acy_name = "00"; obj.From_date = "'2020-08-07'"; obj.To_date = "'2020-08-07'"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CAcy.Update(obj, new DAL()); obj1 = CAcy_exten.SearchName(obj.Acy_name, new DAL()); obj2 = CAcy_exten.PKId(obj1.Acy_id, new DAL()); Assert.AreEqual(obj.Acy_id, obj2.Acy_id); Assert.AreEqual(obj.Acy_name, obj2.Acy_name); Assert.AreEqual(obj.From_date, obj2.From_date); Assert.AreEqual(obj.To_date, obj2.To_date); Assert.AreEqual(obj.Notes, obj2.Notes); Assert.AreEqual(obj.Active_id, obj2.Active_id); Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); #endregion [Update] #region [delete] CAcy.Delete(obj.Acy_id, new DAL()); obj2 = CAcy_exten.PKId(obj1.Acy_id, new DAL()); Assert.AreEqual(null, obj2.Acy_id); #endregion [delete] #region [active] obj = new Acy() { Acy_id = "", Acy_name = "00", From_date = "'2020-08-07'", To_date = "'2020-08-07'", Notes = Core.EmptyNotes, Active_id = Core.Active, User_id = Current.Codexsun }; CAcy.Insert(obj, new DAL()); obj1 = CAcy_exten.SearchName(obj.Acy_name, new DAL()); obj2 = CAcy_exten.PKId(obj1.Acy_id, new DAL()); List <Acy> list = CAcy_exten.Active(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, list[i].Active_id); } } #endregion [Active] #region [Not Active] obj.Acy_id = obj1.Acy_id; obj.Acy_name = "00"; obj.From_date = "'2020-08-07'"; obj.To_date = "'2020-08-07'"; obj.Notes = "test notes"; obj.Active_id = Core.NotActive; obj.User_id = Current.Codexsun; CAcy.Update(obj, new DAL()); list = CAcy_exten.NotActive(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.NotActive, list[i].Active_id); } } #endregion [Not Active] #region [Lookup] obj.Acy_id = obj1.Acy_id; obj.Acy_name = "00"; obj.From_date = "'2020-08-07'"; obj.To_date = "'2020-08-07'"; obj.Notes = "test notes"; obj.Active_id = Core.Active; obj.User_id = Current.Codexsun; CAcy.Update(obj, new DAL()); DataTable tbl = CAcy_exten.GetforLookup(new DAL()); if (list.Count != 0) { for (int i = 0; i < list.Count; i++) { Assert.AreEqual(Core.Active, (tbl.Rows[i][COUNTRY.ACTIVE_ID]) + ""); } } #endregion [Lookup] #region [Get id name] Assert.AreEqual(CAcy_exten.GetId_Name(obj.Acy_name), obj.Acy_id + ""); Assert.AreEqual(CAcy_exten.GetName_Id(obj.Acy_id), obj.Acy_name + ""); CAcy.Delete(obj.Acy_id, new DAL()); #endregion [Get id name] }