Inheritance: sp_Group_Con
Exemple #1
0
        public void TestGroupCreate()
        {
            string groupName = "TestGroup";
            string shortDesc = "We Rock!";
            string longDesc = "We will, we will, rock you!";
            int levelID = 5;
            var group_bll = new sp_Group_BLL();
            var group_dm = new sp_Group_DM();
            group_dm.GroupName = groupName;
            group_dm.ShortDesc = shortDesc;
            group_dm.LongDesc = longDesc;
            group_dm.ParticipationLevelID = levelID;
            var groupID = group_bll.InsertGroupContext(ref group_dm).GroupID;
            group_dm.GroupID = groupID;

            var group_dm_selected = group_bll.ListGroups(groupID);
            Assert.IsTrue(Equals(group_dm, group_dm_selected));
        }
Exemple #2
0
        public void TestGroupAddrCreate()
        {
            var group_bll = new sp_Group_BLL();
            var groupAddr_bll = new sp_GroupAddr_BLL();
            var groupAddr_dm = new sp_GroupAddr_DM();
            var allGroups = group_bll.ListGroups();
            Assert.IsTrue(allGroups.Count > 0, "The allGroups() is broken, or no data in DB");
            groupAddr_dm.GroupID = allGroups[0].GroupID;
            groupAddr_dm.PrimaryAddrID = true;
            groupAddr_dm.ActiveFlg = true;
            var volAddress_bll = new sp_Vol_Address_BLL();
            var volAddress_dm = volAddress_bll.ListAddress(new sp_Vol_Address_DM());
            groupAddr_bll.InsertAddressContext(ref volAddress_dm, ref groupAddr_dm);
            groupAddr_dm.AddrID = volAddress_dm.AddrID;

            var groupAddr_dm_selected = groupAddr_bll.ListAddress(groupAddr_dm);
            Assert.IsTrue(Equals(groupAddr_dm, groupAddr_dm_selected));
        }
Exemple #3
0
        public void TestGroupVolCreate()
        {
            var group_bll = new sp_Group_BLL();
            var vol_bll = new sp_Volunteer_BLL();
            var groupVol_bll = new sp_GroupVol_BLL();
            var groupVol_dm = new sp_Vol_GroupVol_DM();
            var allGroups = group_bll.ListGroups();
            var allVols = vol_bll.ListVolunteers();
            Assert.IsTrue(allGroups.Count > 0, "ListGroups() is broken or no data in DB");
            Assert.IsTrue(allVols.Count > 0, "ListVolunteers() is broken or no data in DB");
            groupVol_dm.GroupID = allGroups[0].GroupID;
            groupVol_dm.VolID = allVols[0].VolID;
            groupVol_dm.Admin = true;
            groupVol_dm.PrimaryVolID = true;
            groupVol_bll.InsertGroupContext(ref groupVol_dm);

            var groupVol_dm_selected = groupVol_bll.ListGroupVols(groupVol_dm);
            Assert.AreEqual(1, groupVol_dm_selected.Count);
            Assert.IsTrue(Equals(groupVol_dm, groupVol_dm_selected[0]));
        }
Exemple #4
0
        public void TestGroupDelete()
        {
            var group_bll = new sp_Group_BLL();
            var allGroups = group_bll.ListGroups();
            Assert.IsTrue(allGroups.Count > 0, "The ListGroups() is broken, or no data in DB");
            var currGroup = allGroups[0];
            //TODO: change activeflg to bool not bool?
            var notActive = currGroup.ActiveFlg != true;
            var i = 1;
            while (notActive)
            {
                currGroup = allGroups[i];
                notActive = currGroup.ActiveFlg != true;
            }
            group_bll.DeleteGroupContext(currGroup);
            var selectedGroup = group_bll.ListGroups(currGroup.GroupID);

            //TODO: change activeflg to bool not bool?
            Assert.IsNotNull(selectedGroup.ActiveFlg);
            Assert.IsFalse(selectedGroup.ActiveFlg == true);
            Assert.IsTrue(selectedGroup.ActiveFlg == false);
        }
Exemple #5
0
        public void TestGroupRead()
        {
            //Pull our data from the excel file
            string helperDir = cExcel.GetHelperFilesDir();
            DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "Group.xlsx"));
            var excelDMs = DMsFrom(dt);
            //Pull our data directly from the DB
            var numRows = cExcel.getNumRecordsFromDB("[Vol].[tblGroup]");

            //Pull our data from the DB through the BLL
            var group_bll = new sp_Group_BLL();
            var allGroups = group_bll.ListGroups();

            //Test the data from the BLL
            Assert.AreEqual(numRows, allGroups.Count);
            foreach (var testGroup in excelDMs)
            {
                var selectedGroup = group_bll.ListGroups(testGroup.GroupID);
                Assert.IsTrue(Equals(testGroup, selectedGroup));
            }
        }
Exemple #6
0
        public void TestGroupUpdate()
        {
            var group_bll = new sp_Group_BLL();
            var allGroups = group_bll.ListGroups();
            Assert.IsTrue(allGroups.Count > 0, "The ListGroups() is broken, or no data in DB");
            var firstGroup = allGroups[0];
            var newGroupName = "Updated Group Name";
            firstGroup.GroupName = newGroupName;
            group_bll.UpdateGroupContext(firstGroup);
            var selectedGroup = group_bll.ListGroups(firstGroup.GroupID);

            Assert.IsTrue(Equals(firstGroup, selectedGroup));
            Assert.AreEqual(newGroupName, selectedGroup.GroupName);
        }