Example #1
0
        public LecturerPage()
        {
            VM = new LecturerPageVM(ConnectionConfigs.LiveConfig, App.AppUser);
            this.SetMenuButtonColor(MenuButtonsSelection.LecturersPage);
            InitializeComponent();
            Mediator.Register(MediatorChannels.LecturerPageGeneratePasswordCheck.ToString(), ShowPasswordConfBox);
            Mediator.Register(MediatorChannels.LecturerPageNewPasswordDisplay.ToString(), ShowPasswordDisplay);
            Mediator.Register(MediatorChannels.DeleteLecturerConfirmation.ToString(), DeleteLecturerConfirmation);

            DataContext = VM;
        }
Example #2
0
        public void ToggleAdmin_ToFalse_Success()
        {
            //Arrange
            ClearDatabase();
            CreateMySessionTestData(_lecturer);
            VM = new LecturerPageVM(dbConName, _lecturer);
            VM.SelectedLecturer = VM.Lecturers.Where(l => l.Name.Equals("Gavin Hales")).FirstOrDefault();
            //Act
            bool result = VM.ToggleAdminRole(VM.SelectedLecturer);

            //Assert
            Assert.IsTrue(result);
            Assert.IsFalse(VM.SelectedLecturer.IsSuperAdmin);
        }
Example #3
0
        public void ToggleAdmin_CantDoSelf_False()
        {
            //Arrange
            ClearDatabase();
            CreateMySessionTestData(_lecturer);
            VM = new LecturerPageVM(dbConName, _lecturer);
            VM.SelectedLecturer = VM.Lecturers.Where(l => l.Id == VM.User.Id).FirstOrDefault();
            //Act
            bool result = VM.ToggleAdminRole(VM.SelectedLecturer);

            result = VM.ToggleAdminRole(VM.SelectedLecturer);
            //Assert
            Assert.IsFalse(result);
            Assert.IsTrue(VM.SelectedLecturer.IsSuperAdmin);
        }