public void UpdateMethodOK() { var AllClaims = new clsClaimCollection(); var TestItem = new clsClaim(); var PrimaryKey = 0; TestItem.ClaimStatus = true; TestItem.ClaimAmnt = 295255.18M; TestItem.ClaimDate = DateTime.Now.Date; TestItem.ClaimID = 1; TestItem.ClaimReason = "sem"; TestItem.CustomerID = 8194; TestItem.StaffID = 16; AllClaims.ThisClaim = TestItem; PrimaryKey = AllClaims.Add(); TestItem.ClaimID = PrimaryKey; TestItem.ClaimStatus = false; TestItem.ClaimAmnt = 125.12M; TestItem.ClaimDate = DateTime.Now.Date; TestItem.ClaimID = 95; TestItem.ClaimReason = "Lorem Ipsum"; TestItem.CustomerID = 34; TestItem.StaffID = 81; AllClaims.ThisClaim = TestItem; AllClaims.Update(); AllClaims.ThisClaim.Find(PrimaryKey); Assert.AreEqual(AllClaims.ThisClaim, TestItem); }
protected void btnOk_Click(object sender, EventArgs e) { var AClaim = new clsClaim(); var ClaimReason = txtClaimReason.Text; var ClaimDate = txtClaimDate.Text; var ClaimAmnt = txtClaimAmnt.Text; var CustomerID = txtCustomerID.Text; var StaffID = txtStaffID.Text; var ClaimStatus = txtClaimStatus.Text; var error = ""; error = AClaim.Valid(StaffID, CustomerID, ClaimDate, ClaimAmnt, ClaimReason, ClaimStatus); if (error == "") { AClaim.ClaimID = ClaimID; AClaim.ClaimReason = ClaimReason; AClaim.ClaimDate = Convert.ToDateTime(ClaimDate); AClaim.CustomerID = Convert.ToInt32(CustomerID); AClaim.ClaimAmnt = Convert.ToDecimal(ClaimAmnt); AClaim.ClaimStatus = Convert.ToBoolean(ClaimStatus); AClaim.StaffID = Convert.ToInt32(StaffID); var ClaimList = new clsClaimCollection(); if (ClaimID == -1) { ClaimList.ThisClaim = AClaim; ClaimList.Add(); } else { ClaimList.ThisClaim.Find(ClaimID); ClaimList.ThisClaim = AClaim; ClaimList.Update(); } Response.Redirect("ClaimList.aspx"); } else { lblError.Text = error; } }
public void DeleteMethodOK() { var AllClaims = new clsClaimCollection(); var TestItem = new clsClaim(); var PrimaryKey = 0; TestItem.ClaimStatus = true; TestItem.ClaimAmnt = 295255.18M; TestItem.ClaimDate = DateTime.Now.Date; TestItem.ClaimID = 1; TestItem.ClaimReason = "sem"; TestItem.CustomerID = 8194; TestItem.StaffID = 16; AllClaims.ThisClaim = TestItem; PrimaryKey = AllClaims.Add(); TestItem.ClaimID = PrimaryKey; AllClaims.ThisClaim.Find(PrimaryKey); AllClaims.Delete(); var found = AllClaims.ThisClaim.Find(PrimaryKey); Assert.IsFalse(found); }