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 List<User> LoadUserData();
//public List<Note> LoadNote();
}
}

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

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

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

Loading…
Cancel
Save