예제 #1
0
 /// <summary>
 /// Constructor for the Groups List view
 /// </summary>
 /// <param name="user"></param>
 /// <param name="adding"></param>
 public GroupsModel(MxUser user, bool adding)
 {
     GroupNameDictionary = BLL.Groups.GetGroupsDict();
     SortedNames         = GroupNameDictionary.Keys.ToList();
     SortedNames.Sort();
     Usr = user;
 }
예제 #2
0
        //this will test our sort function
        public void checkNameSorter()
        {
            //arrange
            FullName nameOne   = new FullName("Sally Anne ", "Smith");
            FullName nameTwo   = new FullName("Sally Anne ", "Jones");
            FullName nameThree = new FullName("Sally Aaron Peta ", "Smith");

            FullName[] names = new FullName[3];
            names[0] = nameOne;
            names[1] = nameTwo;
            names[2] = nameThree;
            FullName[] actual   = new FullName[3];
            FullName[] expected = new FullName[3];
            // this is the alphabetical order of the names
            // which is what we should get back
            expected[0] = names[1];
            expected[1] = names[2];
            expected[2] = names[0];
            //act
            SortedNames s = new SortedNames();

            actual = s.SortNames(names);

            //assert
            Assert.AreEqual(expected[0], actual[0]);
            Assert.AreEqual(expected[1], actual[1]);
            Assert.AreEqual(expected[2], actual[2]);
        }