public void ListAndCountOK() { //create an instance of the class we want to create ClsAddressCollection AllAddresses = new ClsAddressCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <ClsAddress> TestList = new List <ClsAddress>(); //add an item to the list //create the item of test data ClsAddress TestItem = new ClsAddress(); //set its properties TestItem.Active = true; TestItem.AddressNo = 1; TestItem.CountyNo = 1; TestItem.DateAdded = DateTime.Now.Date; TestItem.HouseNo = "123a"; TestItem.PostCode = "LE1 1WE"; TestItem.Street = "some street"; TestItem.Town = "some town"; //add the item to te test list TestList.Add(TestItem); //assign the data to the property AllAddresses.AddressList = TestList; //test to see that the two values are the same Assert.AreEqual(AllAddresses.Count, TestList.Count); }
public void UpdateMethodOK() { //create an instance of the class we want to create ClsAddressCollection AllAddresses = new ClsAddressCollection(); //create the item of test data ClsAddress TestItem = new ClsAddress(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.Active = true; TestItem.AddressNo = 1; TestItem.CountyNo = 1; TestItem.DateAdded = DateTime.Now.Date; TestItem.HouseNo = "123a"; TestItem.PostCode = "LE1 1WE"; TestItem.Town = "some town"; TestItem.Street = "some street"; //set ThisAddress to the test data AllAddresses.ThisAddress = TestItem; //add the record PrimaryKey = AllAddresses.Add(); //set the primary key of the test data TestItem.AddressNo = PrimaryKey; //find the record AllAddresses.ThisAddress.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllAddresses.ThisAddress, TestItem); }
public void InstanceOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //test to see that it exists Assert.IsNotNull(AnAddress); }
public bool Update_Validate(ref System.Text.StringBuilder Sb_Msg) { bool IsValid = true; ClsAddress Obj = this.mObj_Address; WebControl Wc; Wc = this.Txt_Address; ClsBasePageDetails.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Txt_Address.Text.Trim() == "") , "Address is required." + "<br />"); Wc = this.Txt_City; ClsBasePageDetails.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Txt_City.Text.Trim() == "") , "City is required." + "<br />"); Wc = this.Txt_ZipCode; ClsBasePageDetails.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Txt_ZipCode.Text.Trim() == "") , "Zip Code is required." + "<br />"); Wc = this.Cbo_State; ClsBasePageDetails.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Cbo_State.SelectedValue == "0") , "Province / State is required." + "<br />"); Wc = this.Cbo_Country; ClsBasePageDetails.Save_Validation( ref Sb_Msg , ref Wc , ref IsValid , Layer01_Constants_Web.CnsCssTextbox , Layer01_Constants_Web.CnsCssTextbox_ValidateHighlight , (this.Cbo_Country.SelectedValue == "0") , "Country is required." + "<br />"); return(IsValid); }
public void Setup(ClsAddress pObj_Address) { ClsSysCurrentUser CurrentUser = (ClsSysCurrentUser)this.Session[Layer01_Constants_Web.CnsSession_CurrentUser]; this.mObjID = CurrentUser.GetNewPageObjectID(); this.mObj_Address = pObj_Address; this.ViewState[CnsObjID] = this.mObjID; this.Session[this.mObjID + CnsObj_Address] = this.mObj_Address; this.SetupPage(); }
protected void Page_Load(object sender, EventArgs e) { this.EOCb_Accept.Execute += new EO.Web.CallbackEventHandler(EOCb_Accept_Execute); this.EOCb_Cancel.Execute += new EO.Web.CallbackEventHandler(EOCb_Cancel_Execute); //[-] this.mObjID = (string)this.ViewState[CnsObjID]; this.mObj_Customer = (ClsCustomer)this.Session[this.mObjID + CnsObj_Customer]; this.mObj_Address = (ClsAddress)this.Session[this.mObjID + CnsObj_Address]; this.mTmpKey = (this.ViewState[CnsTmpKey] != null) ? (Int64)this.ViewState[CnsTmpKey] : 0; }
public void PostCodePropertyOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //create some test data to assign to the property string TestData = "LE1 4AB"; //assign the data to the property AnAddress.PostCode = TestData; //test to see that the two values are the same Assert.AreEqual(AnAddress.PostCode, TestData); }
public void CountyNoPropertyOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //create some test data to assign to the property Int32 TestData = 1; //assign the data to the property AnAddress.CountyNo = TestData; //test to see that the two values are the same Assert.AreEqual(AnAddress.CountyNo, TestData); }
public void DateAddedPropertyOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //create some test data to assign to the property DateTime TestData = DateTime.Now.Date; //assign the data to the property AnAddress.DateAdded = TestData; //test to see that the two values are the same Assert.AreEqual(AnAddress.DateAdded, TestData); }
public void ActivePropertyOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //create some test data to assign to the property Boolean TestData = true; //assign the data to the property AnAddress.Active = TestData; //test to see that the two values are the same Assert.AreEqual(AnAddress.Active, TestData); }
public void FindMethodOK() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 AddressNo = 1; //invoke the method Found = AnAddress.Find(AddressNo); //test to see that the result is correct Assert.IsTrue(Found); }
void SetupPage() { DataRow[] ArrDr = this.mObj_Customer.pDt_ShippingAddress.Select("TmpKey = " + this.mTmpKey); DataRow Dr_ShippingAddress = null; if (ArrDr.Length > 0) { Dr_ShippingAddress = ArrDr[0]; } else { this.mTmpKey = 0; } if (this.mTmpKey == 0) { this.Txt_StoreCode.Text = ""; //this.mObj_Address = new ClsAddress(this.mObj_Customer.pCurrentUser); //this.mObj_Address.Load(); Dr_ShippingAddress = this.mObj_Customer.pObj_ShippingAddress.Add_Item(); this.mTmpKey = Do_Methods.Convert_Int64(Dr_ShippingAddress["TmpKey"]); this.mObj_Address = this.mObj_Customer.pObj_ShippingAddress_Address_Get(this.mTmpKey); this.mObj_Address.pDr["Address"] = this.mObj_Customer.pDr_Address["Address"]; this.mObj_Address.pDr["City"] = this.mObj_Customer.pDr_Address["City"]; this.mObj_Address.pDr["LookupID_States"] = this.mObj_Customer.pDr_Address["LookupID_States"]; this.mObj_Address.pDr["LookupID_Country"] = this.mObj_Customer.pDr_Address["LookupID_Country"]; this.mObj_Address.pDr["ZipCode"] = this.mObj_Customer.pDr_Address["ZipCode"]; this.UcAddress_ShippingAddress.Setup(this.mObj_Address); this.ViewState[CnsTmpKey] = this.mTmpKey; } else { this.Txt_StoreCode.Text = (string)Do_Methods.IsNull(Dr_ShippingAddress["StoreCode"], ""); //this.mObj_Address = (ClsAddress)this.mObj_Customer.pBO_ShippingAddress_Address[this.mTmpKey.ToString()]; this.mObj_Address = this.mObj_Customer.pObj_ShippingAddress_Address_Get(this.mTmpKey); this.UcAddress_ShippingAddress.Setup(this.mObj_Address); } this.Session[this.mObjID + CnsObj_Address] = this.mObj_Address; try { this.EOCbp_Dialog_ShippingAddress.Update(); } catch { } }
void SetupPage() { this.SetupPage_ControlAttributes(); this.SetupPage_Lookups(); ClsAddress Obj = this.mObj_Address; this.Txt_Address.Text = (string)Do_Methods.IsNull(Obj.pDr["Address"], ""); this.Txt_City.Text = (string)Do_Methods.IsNull(Obj.pDr["City"], ""); this.Txt_ZipCode.Text = (string)Do_Methods.IsNull(Obj.pDr["ZipCode"], ""); try { this.Cbo_State.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(Obj.pDr["LookupID_States"], 0)).ToString(); } catch { } try { this.Cbo_Country.SelectedValue = Convert.ToInt64(Do_Methods.IsNull(Obj.pDr["LookupID_Country"], 0)).ToString(); } catch { } }
public void TestActiveFound() { //create an instance of the class we want to create ClsAddress AnAddress = new ClsAddress(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assume it is) Boolean OK = true; //create some test data to use with the method Int32 AddressNo = 21; //invoke the method Found = AnAddress.Find(AddressNo); //check the property if (AnAddress.Active != true) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void ThisAddressPropertyOK() { //Create an instance of the class we want to create ClsAddressCollection AllAddresses = new ClsAddressCollection(); //create some test data to assign to the property ClsAddress TestAddress = new ClsAddress(); //set the propertied of the test object TestAddress.Active = true; TestAddress.AddressNo = 1; TestAddress.CountyNo = 1; TestAddress.DateAdded = DateTime.Now.Date; TestAddress.HouseNo = "123a"; TestAddress.PostCode = "LE1 1WE"; TestAddress.Street = "some street"; TestAddress.Town = "some town"; //assign the data to the property AllAddresses.ThisAddress = TestAddress; //test to see that the two values are the same Assert.AreEqual(AllAddresses.ThisAddress, TestAddress); }
public void Update() { ClsAddress Obj = this.mObj_Address; Obj.pDr["Address"] = this.Txt_Address.Text; Obj.pDr["City"] = this.Txt_City.Text; Obj.pDr["ZipCode"] = this.Txt_ZipCode.Text; Obj.pDr["LookupID_States"] = Convert.ToInt64(this.Cbo_State.SelectedValue); Obj.pDr["LookupID_Country"] = Convert.ToInt64(this.Cbo_Country.SelectedValue); System.Text.StringBuilder Sb_Address = new System.Text.StringBuilder(); Sb_Address.Append(this.Txt_Address.Text); Sb_Address.Append("\r " + this.Txt_City.Text); Sb_Address.Append("\r " + (this.Cbo_State.SelectedValue == "0" ? "" : this.Cbo_State.SelectedItem.Text)); Sb_Address.Append("\r " + this.Txt_ZipCode.Text); Sb_Address.Append("\r " + (this.Cbo_Country.SelectedValue == "0" ? "" : this.Cbo_Country.SelectedItem.Text)); Obj.pDr["Address_Complete"] = Sb_Address.ToString(); Do_Methods.ConvertCaps(Obj.pDr); }
protected void Page_Load(object sender, EventArgs e) { this.mObjID = (string)this.ViewState[CnsObjID]; this.mObj_Address = (ClsAddress)this.Session[this.mObjID + CnsObj_Address]; }
protected override void Setup(ClsSysCurrentUser CurrentUser, string TableName, string ViewName = "", string CacheTableName = "") { base.Setup(CurrentUser, TableName, ViewName, CacheTableName); this.mObj_Address = new ClsAddress(this.mCurrentUser); }