Fix code smell
continuous-integration/drone/push Build is failing Details

refonte_program
Matheo THIERRY 2 years ago
parent cff31cec4f
commit 8fcb08ed63

@ -15,7 +15,5 @@ namespace Biblioteque_de_Class
public void SaveUserData(User user); public void SaveUserData(User user);
public List<User> LoadUserData(); public List<User> LoadUserData();
//public List<Note> LoadNote();
} }
} }

@ -55,11 +55,11 @@ namespace Biblioteque_de_Class
/// <summary> /// <summary>
/// rechercher une note dans la liste de note de l'utilisateur /// rechercher une note dans la liste de note de l'utilisateur
/// </summary> /// </summary>
public List<Note> SearchNoteByName(string name) public List<Note> SearchNoteByName(List<Note> ToResearchIntoList, string name)
{ {
List<Note> searchedNotes = new List<Note>(); List<Note> searchedNotes = new List<Note>();
string search = name.ToLower(); string search = name.ToLower();
foreach (Note note in NoteList) foreach (Note note in ToResearchIntoList)
{ {
if (note.GetName().ToLower().Contains(search)) if (note.GetName().ToLower().Contains(search))
{ {
@ -72,11 +72,11 @@ namespace Biblioteque_de_Class
/// <summary> /// <summary>
/// rechercher une note dans la liste de note favoris de l'utilisateur /// rechercher une note dans la liste de note favoris de l'utilisateur
/// </summary> /// </summary>
public List<Note> SearchFavoriteNoteByName(string name) public List<Note> SearchFavoriteNoteByName(List<Note> ToResearchIntoList, string name)
{ {
List<Note> searchedNotes = new List<Note>(); List<Note> searchedNotes = new List<Note>();
string search = name.ToLower(); string search = name.ToLower();
foreach (Note note in FavList) foreach (Note note in ToResearchIntoList)
{ {
if (note.GetName().ToLower().Contains(search)) if (note.GetName().ToLower().Contains(search))
{ {
@ -89,11 +89,11 @@ namespace Biblioteque_de_Class
/// <summary> /// <summary>
/// rechercher un tag dans la liste de tag de l'utilisateur /// rechercher un tag dans la liste de tag de l'utilisateur
/// </summary> /// </summary>
public List<Tags> SearchTagByName(string name) public List<Tags> SearchTagByName(List<Tags> ToResearchIntoList, string name)
{ {
List<Tags> searchedTags = new List<Tags>(); List<Tags> searchedTags = new List<Tags>();
string search = name.ToLower(); string search = name.ToLower();
foreach (Tags tag in TagList) foreach (Tags tag in ToResearchIntoList)
{ {
if (tag.GetName().ToLower().Contains(search)) if (tag.GetName().ToLower().Contains(search))
{ {
@ -109,7 +109,7 @@ namespace Biblioteque_de_Class
string search = name.ToLower(); string search = name.ToLower();
foreach (Note note in ToResearchIntoList) foreach (Note note in ToResearchIntoList)
{ {
if (note.GetName().ToLower().Contains(search) && note.GetCreationDate() >= FirstDate && note.GetCreationDate() <= SecondeDate) if (note.GetName().ToLower().Contains(search) && note.GetCreationDate() >= FirstDate && note.GetCreationDate() <= SecondeDate || note.GetModificationDate() >= FirstDate && note.GetModificationDate() <= SecondeDate)
{ {
searchedNotes.Add(note); searchedNotes.Add(note);
} }
@ -164,16 +164,16 @@ namespace Biblioteque_de_Class
/// <summary> /// <summary>
/// supprimer une note /// supprimer une note
/// </summary> /// </summary>
public void DeleteNote(string name) public void DeleteNote(string note)
{ {
foreach (Note note in NoteList) foreach (Note existingNote in NoteList)
{ {
if (note.GetName() == name) if (existingNote.GetName() == note)
{ {
NoteList.Remove(note); NoteList.Remove(existingNote);
NoteTagged.Remove(note); NoteTagged.Remove(existingNote);
} return;
else }else
{ {
throw new NotFoundException("Note not found"); throw new NotFoundException("Note not found");
} }

@ -66,7 +66,7 @@ switch (Console.ReadLine())
} }
//connection //connection
while (connection == true) while (connection)
{ {
connection = false; connection = false;
Console.WriteLine("\nEntrez un nom : "); Console.WriteLine("\nEntrez un nom : ");
@ -84,7 +84,7 @@ while (connection == true)
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
connection = true; connection = true;
} }
if (connection == false) if (!connection)
{ {
if (Database.ComparePassword(u, password)) if (Database.ComparePassword(u, password))
{ {
@ -98,11 +98,11 @@ while (connection == true)
u = uvide; u = uvide;
} }
} }
while (continuerboucle == true) { connection = continuer(); } while (continuerboucle) { connection = continuer(); }
} }
//inscription //inscription
while (inscription == true) while (inscription)
{ {
Console.WriteLine("\nEntrez un nom :"); Console.WriteLine("\nEntrez un nom :");
string? nom = Console.ReadLine(); string? nom = Console.ReadLine();
@ -122,12 +122,12 @@ while (inscription == true)
break; break;
} }
Console.WriteLine("\nNom d'utilisateur déjà utilisé. \n"); Console.WriteLine("\nNom d'utilisateur déjà utilisé. \n");
while (continuerboucle == true) { inscription = continuer(); } while (continuerboucle) { inscription = continuer(); }
} }
//une fois connecté ou inscription fait //une fois connecté ou inscription fait
while (u.GetIsConnected() == true) while (u.GetIsConnected())
{ {
Console.WriteLine("\n|--------------------------------------|"); Console.WriteLine("\n|--------------------------------------|");
Console.WriteLine("| |"); Console.WriteLine("| |");
@ -156,13 +156,13 @@ while (u.GetIsConnected() == true)
case "2": case "2":
Console.WriteLine("\nChoisissez le nom de la note (entrer - nom par defaut)"); Console.WriteLine("\nChoisissez le nom de la note (entrer - nom par defaut)");
string? wantedNameNote = Console.ReadLine(); string? wantedNameNote = Console.ReadLine();
if(wantedNameNote == null) { wantedNameNote = ""; } wantedNameNote??= "";
u.CreateNote(wantedNameNote, ""); u.CreateNote(wantedNameNote, "");
break; break;
case "3": case "3":
Console.WriteLine("\nChoisissez le nom de la note"); Console.WriteLine("\nChoisissez le nom de la note");
string? wantedDeleteNote = Console.ReadLine(); string? wantedDeleteNote = Console.ReadLine();
if (wantedDeleteNote == null) { wantedDeleteNote= ""; } wantedDeleteNote??= "";
try try
{ {
u.DeleteNote(wantedDeleteNote); u.DeleteNote(wantedDeleteNote);
@ -184,7 +184,7 @@ while (u.GetIsConnected() == true)
break; break;
} }
while (tags == true) while (tags)
{ {
Console.WriteLine("\n|--------------------------------------|"); Console.WriteLine("\n|--------------------------------------|");
Console.WriteLine("| |"); Console.WriteLine("| |");
@ -201,7 +201,7 @@ while (u.GetIsConnected() == true)
tags =false; tags =false;
} }
while(para == true) while(para)
{ {
Console.WriteLine("\n|--------------------------------------|"); Console.WriteLine("\n|--------------------------------------|");
Console.WriteLine("| |"); Console.WriteLine("| |");
@ -218,7 +218,7 @@ while (u.GetIsConnected() == true)
para = false; para = false;
} }
while (theme == true) while (theme)
{ {
Console.WriteLine("\n|--------------------------------------|"); Console.WriteLine("\n|--------------------------------------|");
Console.WriteLine("| |"); Console.WriteLine("| |");

@ -19,9 +19,7 @@ namespace Notus_UnitTest_Database
[Test] [Test]
public void GetLogoLink_LogoExists_ReturnsLogoLink() public void GetLogoLink_LogoExists_ReturnsLogoLink()
{ {
string logoName = "Logo2"; Assert.That(database.GetLogoLink("Logo2"), Is.EqualTo("link2"));
string logoLink = database.GetLogoLink(logoName);
Assert.That(logoLink, Is.EqualTo("link2"));
} }
[Test] [Test]

Loading…
Cancel
Save