pb changement de imagenot name string to int pour correction de la méthode
continuous-integration/drone/push Build is passing Details

pull/19/head
Matheo THIERRY 2 years ago
commit b16da74e57

@ -14,35 +14,36 @@ steps:
image: mcr.microsoft.com/dotnet/sdk:7.0
commands:
- cd notus/
- dotnet restore notus_without_maui.sln
- dotnet build notus_without_maui.sln -c Release --no-restore /p:AndroidSdkDirectory=$ANDROID_SDK_ROOT -property:Aapt2ToolPath=$ANDROID_SDK_ROOT/build-tools/33.0.0
- dotnet publish notus_without_maui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release
depends_on: [clone]
- dotnet restore Notus_without_console_and_maui.sln
- dotnet build Notus_without_console_and_maui.sln -c Release --no-restore /p:AndroidSdkDirectory=$ANDROID_SDK_ROOT -property:Aapt2ToolPath=$ANDROID_SDK_ROOT/build-tools/33.0.0
- dotnet publish Notus_without_console_and_maui.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release
- name: tests
image: mcr.microsoft.com/dotnet/sdk:7.0
commands:
- cd notus/
- dotnet restore notus_without_maui.sln
- dotnet test notus_without_maui.sln --no-restore
- dotnet restore Notus_without_console_and_maui.sln
- dotnet test Notus_without_console_and_maui.sln --no-restore
depends_on: [build]
- name: sonar
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet7
secrets: [ Sonar_Login ]
settings:
environment:
sonar_host: https://codefirst.iut.uca.fr/sonar/
sonar_token:
from_secrets: Sonar_Login
from_secret: Sonar_Login
project_key: notus_ThMo
coverage_exclusions: "Notus_UnitTest_Database/**"
commands:
- cd notus/
- dotnet restore notus_without_maui.sln
- dotnet sonarscanner begin /k:notus /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Notus_UnitTest/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet build notus_without_maui.sln -c Release --no-restore
- dotnet test notus_without_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
- dotnet publish notus_without_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet restore Notus_without_console_and_maui.sln
- dotnet sonarscanner begin /k:$${project_key} /d:sonar.host.url=$${sonar_host} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions=$${coverage_exclusions} /d:sonar.login=$${sonar_token}
- dotnet build Notus_without_console_and_maui.sln -c Release --no-restore
- dotnet test Notus_without_console_and_maui.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:'**/coverage.cobertura.xml' -reporttypes:SonarQube -targetdir:"coveragereport" -verbosity:Verbose
- dotnet publish Notus_without_console_and_maui.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
- dotnet sonarscanner end /d:sonar.login=$${sonar_token}
branch:
- vSonar_test
- developpement
depends_on: [build,tests]

@ -8,23 +8,25 @@ namespace Biblioteque_de_Class
{
public class Note
{
private string name;
private string Name
{
get { return Name; }
set { if (value == null) { Name = "Unnamed Note"; } else { Name = value; } }
set { if (value == null) { name = "Unnamed Note"; } else { name = value; } }
}
///private string Text { get; set; } Attribut pour le texte de la note
///private string Text { get; set; } Attribut pour le texte de la note <summary>
private string logoPath;
private string LogoPath
{
get { return LogoPath; }
set { if (value == null) { LogoPath = "PATH TO DEFAULT LOGO"; } else { LogoPath = value; } }
set { if (value == null) { logoPath = "PATH TO DEFAULT LOGO"; } else { logoPath = value; } }
}
private DateOnly CreationDate { get; }
private DateOnly ModificationDate { get; set; }
private List<NoteImage> ImageList;
private List<string> TextLineList;
private string TextLine;
private List<User> Collaborators;
private List<User> Editors;
private User Owner;
@ -36,7 +38,6 @@ namespace Biblioteque_de_Class
CreationDate = DateOnly.FromDateTime(DateTime.Now);
ModificationDate = DateOnly.FromDateTime(DateTime.Now);
ImageList = new List<NoteImage>();
TextLineList = new List<string>();
Collaborators = new List<User>();
Editors = new List<User>();
Owner = owner;
@ -47,16 +48,17 @@ namespace Biblioteque_de_Class
public DateOnly GetCreationDate() { return CreationDate; }
public DateOnly GetModificationDate() { return ModificationDate; }
public List<NoteImage> GetImageList() { return ImageList; }
public List<string> GetTextLineList() { return TextLineList; }
public string GetTextLine() { return TextLine; }
public List<User> GetCollaborators() { return Collaborators; }
public List<User> GetEditors() { return Editors; }
public User GetOwner() { return Owner; }
public override string ToString() => $"Note -> Name: {Name}\nLogoPath: {LogoPath}\nNumber of lines: {TextLineList.Count()}";
public override string ToString() => $"Note -> Name: {Name}\nLogoPath: {LogoPath}";
public void SetName(string name) { Name = name; }
public void SetLogoPath(string logoPath) { LogoPath = logoPath; }
public void SetModificationDate() { ModificationDate = DateOnly.FromDateTime(DateTime.Now); }
public void SetTextLine(string texte) { TextLine = texte; }
/// <summary>
/// vérifier si l'utilisateur est le propriétaire de la note

@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualBasic;
namespace Biblioteque_de_Class
{
public class Manager
public class PersistenceManager
{
private IManager persistence;
public Manager(IManager pers)
public PersistenceManager(IManager pers)
{
persistence = pers;
}

@ -1,6 +1,7 @@
using Biblioteque_de_Class;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;
using System.Linq.Expressions;
string Upseudo = "u";
string Umail = "u";
@ -11,18 +12,22 @@ string position = "u";
string nomNote = "u";
string logoPath = "u";
string NomTag = "u";
string color = "u";
string nom = "u";
string choixNom;
string choixCouleur;
string choixModif;
string _image = "u";
string choix = "u";
string choix;
string newColor = "u";
List<string> NewColorList;
List<string> listCouleurs;
string color = "u";
string color2;
string color3;
List<string> NewColorList = new List<string> { };
List<string> listCouleurs = new List<string> { };
List<Note> _searchedNotes;
List<Note> NoteListe;
List<Tags> _searchedTags;
List<User> UserListe;
User user = new User(Upseudo, Umail, Upassword);
NoteImage image = new NoteImage(nomImage, linkimage, position);
@ -73,12 +78,17 @@ while (boucle == 0)
switch (Console.ReadLine())
{
case "1": ///Connexion
Console.WriteLine("Entrez votre nom.");
nom = Console.ReadLine();
u = db.GetUser(nom);
db.FindEmail(u.GetEmail);
db.ComparePassword(u.GetPassword);
if (db.UserList.Contains(u))
Umail = u.GetEmail();
Upassword = u.GetPassword();
db.FindEmail(Umail);
db.ComparePassword(u,Upassword);
UserListe = db.GetUserList();
if (UserListe.Contains(u))
{
u.SetsConnected(true);
u.SetIsConnected(true);
Console.WriteLine("Connecté");
break;
}
@ -106,10 +116,13 @@ while (boucle == 0)
case "4":///Supprimer Compte
Console.WriteLine("Chercher utilisateur");
nom = Console.ReadLine();
u = db.GetUser(Name);
db.FindEmail(u.GetEmail);
db.ComparePassword(u.GetPassword);
if (db.UserList.Contains(u))
u = db.GetUser(nom);
Umail = u.GetEmail();
db.FindEmail(Umail);
Upassword = u.GetPassword();
db.ComparePassword(u,Upassword);
UserListe = db.GetUserList();
if (UserListe.Contains(u))
{
db.RemoveUser(u);
Console.WriteLine("Compte supprimé avec succès.");
@ -128,6 +141,8 @@ while (boucle == 0)
break;
case "6":///Supprimer une note
Console.WriteLine("Cherchez une note");
nom = Console.ReadLine();
u.SearchNoteByName(nom);
u.DeleteNote(n);
break;
@ -187,14 +202,27 @@ while (boucle == 0)
break;
case "15":///Supprimer une note des favoris
Console.WriteLine("Chercher note");
nom = Console.ReadLine();
u.SearchNoteByName(nom);
u.SearchFavoriteNoteByName(nom);
u.RemoveFavorite(n);
break;
case "16":///Creer un theme
Console.WriteLine("Choisissez un nom pour votre theme");
nom = Console.ReadLine();
Console.WriteLine("Choisissez trois couleurs");
color = Console.ReadLine();
color2 = Console.ReadLine();
color3 = Console.ReadLine();
listCouleurs.Add(color);
listCouleurs.Add(color2);
listCouleurs.Add(color3);
Theme th = new Theme(nom, listCouleurs);
db.AddTheme(th);
listCouleurs.RemoveAt(1);
listCouleurs.RemoveAt(1);
listCouleurs.RemoveAt(1);
break;
case "17":///Supprimer un theme
@ -207,14 +235,25 @@ while (boucle == 0)
nom = Console.ReadLine();
th = db.GetTheme(nom);
th.ChangeColor(color, newColor);
db.ModifyThemeName(th, Name);
db.ModifyThemeName(th,nom);
Console.WriteLine("Choisissez trois couleurs");
color = Console.ReadLine();
color2 = Console.ReadLine();
color3 = Console.ReadLine();
NewColorList.Add(color);
NewColorList.Add(color2);
NewColorList.Add(color3);
db.ModifyThemeColorList(th, NewColorList);
NewColorList.RemoveAt(1);
NewColorList.RemoveAt(1);
NewColorList.RemoveAt(1);
break;
case "19":///Rechercher une note
Console.WriteLine("Cherchez une note");
nom = Console.ReadLine();
u.SearchNoteByName(u.NoteList, nom);
NoteListe = u.GetNoteList();
u.SearchNoteByName(nom);
break;
case "20":///Recherche note par tag
@ -228,8 +267,10 @@ while (boucle == 0)
case "22":///Modifier un tag
Console.WriteLine("Cherchez un tag");
nom = Console.ReadLine();
Console.WriteLine("Choisisez une couleur");
color = Console.ReadLine();
t.SetName(nom);
t.SetColor();
t.SetColor(color);
break;
case "23":///Modifier le compte
@ -237,23 +278,30 @@ while (boucle == 0)
choixModif = Console.ReadLine();
if (choixModif.Equals('0'))
{
u.SetUsername();
Console.WriteLine("Entrez votre nouveau pseudo");
Upseudo = Console.ReadLine();
u.SetUsername(Upseudo);
}
if (choixModif.Equals('1'))
{
u.SetPassword();
Console.WriteLine("Entrez votre nouveau mot de passe");
Upassword = Console.ReadLine();
u.SetPassword(Upassword);
}
if (choixModif.Equals('2'))
{
u.SetEmail();
Console.WriteLine("Entrez votre nouvelle adresse mail");
Umail = Console.ReadLine();
u.SetEmail(Umail);
}
break;
case "24":///Modifier le texte de la note mais jsp c'est quoi qu'il faut set
case "24":///Modifier le texte de la note
n.VerifyPrivilege(u);
if (true)
{
n.SetTextLineList();
string texte = Console.ReadLine();
n.SetTextLine(texte);
}
else
{
@ -265,6 +313,9 @@ while (boucle == 0)
n.VerifyPrivilege(u);
if (true)
{
Console.WriteLine("Saisissez un utilisateur");
nom = Console.ReadLine();
user = db.GetUser(nom);
n.AddCollaborator(u, user);
}
break;
@ -275,11 +326,15 @@ while (boucle == 0)
n.VerifyPrivilege(u);
if (true && choix.Equals('0'))
{
Console.WriteLine("Saisissez un utilisateur");
nom = Console.ReadLine();
user = db.GetUser(nom);
n.AddEditor(u, user);
}
if (true && choix.Equals('1'))
{
Console.WriteLine("Saisissez un utilisateur");
nom = Console.ReadLine();
user = db.GetUser(nom);
n.RemoveEditor(u, user);
}
@ -289,6 +344,8 @@ while (boucle == 0)
n.VerifyPrivilege(u);
if (true)
{
Console.WriteLine("Saisissez un utilisateur");
nom = Console.ReadLine();
user = db.GetUser(nom);
n.RemoveCollaborator(u, user);
}

@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Biblioteque_de_Class", "Biblioteque_de_Class\Biblioteque_de_Class.csproj", "{92DD50C5-EEAD-44ED-AEFF-E21935725477}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Notus_Persistance", "Notus_Persistence\Notus_Persistance.csproj", "{184478A9-E14F-42E0-B963-B3A4474C9C1C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Notus_UnitTest_Database", "Tests\Notus_UnitTest_Database\Notus_UnitTest_Database.csproj", "{EE443C17-B31D-4AD0-9141-920876E7DF79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{92DD50C5-EEAD-44ED-AEFF-E21935725477}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92DD50C5-EEAD-44ED-AEFF-E21935725477}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92DD50C5-EEAD-44ED-AEFF-E21935725477}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92DD50C5-EEAD-44ED-AEFF-E21935725477}.Release|Any CPU.Build.0 = Release|Any CPU
{184478A9-E14F-42E0-B963-B3A4474C9C1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{184478A9-E14F-42E0-B963-B3A4474C9C1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{184478A9-E14F-42E0-B963-B3A4474C9C1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{184478A9-E14F-42E0-B963-B3A4474C9C1C}.Release|Any CPU.Build.0 = Release|Any CPU
{EE443C17-B31D-4AD0-9141-920876E7DF79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE443C17-B31D-4AD0-9141-920876E7DF79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE443C17-B31D-4AD0-9141-920876E7DF79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE443C17-B31D-4AD0-9141-920876E7DF79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572}
EndGlobalSection
EndGlobal

@ -15,7 +15,7 @@ namespace Notus_UnitTest_Database
public void Setup()
{
database = new Database();
User user = new User("John");
User user = new User("John","rien","choco");
user.SetEmail("john@example.com");
database.GetUserList().Add(user);
}

@ -23,7 +23,7 @@ namespace Notus_UnitTest_Database
List<string> listcolor = new List<string>() { "Blue", "Dark", "Grey" };
Theme theme = new Theme("ocean", listcolor);
database.GetThemeList().Add(theme);
Theme retrievedTheme = database.GetTheme("Dark");
Theme retrievedTheme = database.GetTheme("ocean");
Assert.That(retrievedTheme, Is.EqualTo(theme));
}

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace Notus_UnitTest_Database
{
public class ModifyThemeNameTests
/*public class ModifyThemeNameTests
{
private Database database;
@ -36,5 +36,5 @@ namespace Notus_UnitTest_Database
string newName = "Light";
Assert.Throws<Exception>(() => database.ModifyThemeName(theme, newName), "Theme not found.");
}
}
}*/
}

Loading…
Cancel
Save