public void Test_CleanNote() { NoteAdministration.Notes.Clear(); Assert.IsTrue(NoteAdministration.AddNote(test.Information, "*****@*****.**")); Assert.IsTrue(NoteAdministration.AddNote(test.Information + "a", "")); Assert.IsTrue(NoteAdministration.AddNote(test.Information + "b", "")); Assert.IsTrue(NoteAdministration.AddNote(test.Information + "c", "*****@*****.**")); NoteAdministration.CleanNotes(new Account("Tester", "Unit", "*****@*****.**")); foreach (Note note in NoteAdministration.Notes) { Assert.IsTrue(note.AccountEmail != ""); } Assert.AreEqual(NoteAdministration.Notes.Count, 2); }
public void UserRefresh() { if (Administration.User != null) { Name_label.Visible = true; UName_label.Visible = true; UName_label.Text = Administration.User.Name; LastName_label.Visible = true; ULastName_label.Visible = true; ULastName_label.Text = Administration.User.LastName; email_label.Visible = true; UEmail_label.Visible = true; UEmail_label.Text = Administration.User.EmailAdress; download_button.Enabled = true; upload_button.Enabled = true; GamePropsal_button.Enabled = true; try { if (CalendarEventAdministration.Agenda.Exists(x => x.AccountEmail == "")) { DialogResult result = MessageBox.Show( "Your agenda contains severall items which aren't linked to an account" + Environment.NewLine + " do you wish link these to you account?", "Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { CalendarEventAdministration.EmptyCalendarToUser(Administration.User); } else if (result == DialogResult.No) { } } CalendarEventAdministration.CleanCalendar(Administration.User); if (AlarmAdministration.Alarm_list.Exists(x => x.AccountEmail == "")) { DialogResult result = MessageBox.Show( "Your alarm list contains severall items which aren't linked to an account" + Environment.NewLine + " do you wish link these to you account?", "Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { AlarmAdministration.EmptyAlarmsToUser(Administration.User); } else if (result == DialogResult.No) { } } AlarmAdministration.CleanAlarms(Administration.User); if (NoteAdministration.Notes.Exists(x => x.AccountEmail == "")) { DialogResult result = MessageBox.Show( "Your Notes contains severall items which aren't linked to an account" + Environment.NewLine + " do you wish link these to you account?", "Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { NoteAdministration.EmptyNotesToUser(Administration.User); } else if (result == DialogResult.No) { } } NoteAdministration.CleanNotes(Administration.User); if (TaskAdministration.Todo.Exists(x => x.AccountEmail == "")) { DialogResult result = MessageBox.Show( "Your ToDo-list contains severall items which aren't linked to an account" + Environment.NewLine + " do you wish link these to you account?", "Confirm", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { TaskAdministration.EmptyTasksToUser(Administration.User); } else if (result == DialogResult.No) { } } TaskAdministration.CleanTasks(Administration.User); } catch (Exception exception) { MessageBox.Show(exception.Message); } } else { Name_label.Visible = false; UName_label.Visible = false; LastName_label.Visible = false; ULastName_label.Visible = false; email_label.Visible = false; UEmail_label.Visible = false; download_button.Enabled = false; upload_button.Enabled = false; GamePropsal_button.Enabled = false; } int todayAppointment = 0; foreach (CalendarEvent appointment in CalendarEventAdministration.Agenda) { if (appointment.StartDate.Date == DateTime.Now.Date || appointment.EndDate.Date == DateTime.Now.Date || (appointment.StartDate.Date <= DateTime.Now.Date && appointment.EndDate.Date >= DateTime.Now.Date)) { todayAppointment += 1; } } Today_label.Text = "Today: " + todayAppointment.ToString(); int tasks = 0; foreach (CForm_Planner.TaskSystem.Task task in TaskAdministration.Todo) { if (task.Completed == false) { tasks += 1; } } TaskP2_label.Text = "Tasks = " + tasks.ToString(); }