예제 #1
0
        public void DeleteGroupStorageControllerTest()
        {
            int old_id = Group.GetNextID();

            SC.CreateGroup("TestGroup", "TestGroupDesc");
            int  new_id = Group.GetNextID();
            bool First  = (new_id > old_id) && SC.GroupDictionary.ContainsKey(old_id);

            if (First)
            {
                SC.DeleteGroup(old_id);
                Assert.IsTrue(!SC.GroupDictionary.ContainsKey(old_id));
            }
            else
            {
                Assert.Fail();
            }
        }
예제 #2
0
 public void SetupEdit()
 {
     btn_deleteGroup.Visibility = Visibility.Visible;
     output_GroupID.Text        = groupToEdit.ID.ToString();
     textBox_Name.Text          = groupToEdit.Name;
     textBox_descr.Text         = groupToEdit.Description;
     btn_JustQuit.Click        += delegate { this.Close(); };
     btn_SaveAndQuit.Click     += delegate
     {
         if (textBox_Name.Text == "" || textBox_descr.Text == "")
         {
             textBox_Name.BorderBrush  = Brushes.DarkGray;
             textBox_descr.BorderBrush = Brushes.DarkGray;
             if (textBox_Name.Text == "")
             {
                 textBox_Name.BorderBrush = Brushes.Red;
             }
             if (textBox_descr.Text == "")
             {
                 textBox_descr.BorderBrush = Brushes.Red;
             }
         }
         else
         {
             string GroupName = textBox_Name.Text;
             string GroupDesc = textBox_descr.Text;
             ControllerSto.EditGroup(groupToEdit.ID, GroupName, GroupDesc);
             this.Close();
         }
     };
     btn_deleteGroup.Click += delegate
     {
         MessageBoxResult results = MessageBox.Show($"Er du sikker på at du vil slette denne gruppe: {groupToEdit.Name} ?", "Slet gruppe:", MessageBoxButton.YesNo, MessageBoxImage.Question);
         if (results == MessageBoxResult.Yes)
         {
             ControllerSto.DeleteGroup(groupToEdit.ID);
             this.Close();
         }
     };
 }