public void InstanceOK() { //create an instance clsRoleCollection AllRoles = new clsRoleCollection(); //check if the instance was created Assert.IsNotNull(AllRoles); }
private void DisplayRoles() { clsRoleCollection Roles = new clsRoleCollection(); ddlRole.DataSource = Roles.allRoles; ddlRole.DataValueField = "roleId"; ddlRole.DataTextField = "roleName"; ddlRole.DataBind(); }
public void RoleCollectionListOK() { //create an instance clsRoleCollection TestInstance = new clsRoleCollection(); //create some test data to assign to the property List <clsRole> TestList = new List <clsRole>(); //a test object clsRole TestRole = new clsRole(); //assign all the properties TestRole.roleId = 1; TestRole.roleName = "Receptionist"; //add the test object to the list TestList.Add(TestRole); //assign the list to the collection class TestInstance.allRoles = TestList; //test to see that the two values are the same Assert.AreEqual(TestInstance.allRoles, TestList); }
void DisplayStaff(String lastNameFilter) { //lstStaff.DataSource = Staff.staffList; //lstStaff.DataValueField = "staffId"; //lstStaff.DataTextField = "lastName"; //lstStaff.DataBind(); Int32 staffId; String staffFirstName; String staffLastName; Int32 staffRoleId; String staffRoleName; clsStaffCollection Staff = new clsStaffCollection(); clsRoleCollection allRoles = new clsRoleCollection(); Staff.ReportByLastName(lastNameFilter); Int32 RecordCount; Int32 Index = 0; RecordCount = Staff.Count; lstStaff.Items.Clear(); while (Index < RecordCount) { staffId = Staff.staffList[Index].staffId; staffFirstName = Staff.staffList[Index].firstName; staffLastName = Staff.staffList[Index].lastName; staffRoleId = Staff.staffList[Index].staffRoleId; staffRoleName = allRoles.allRoles[staffRoleId].roleName; ListItem NewEntry = new ListItem(staffFirstName + " " + staffLastName + " | " + staffRoleName, staffId.ToString()); lstStaff.Items.Add(NewEntry); Index++; } }