Class user usable. Implementation of excpetions with summary
continuous-integration/drone/push Build is failing Details

pull/35/head^2
Roxane ROSSETTO 2 years ago
parent 173bc413b8
commit 1e46072b93

@ -33,18 +33,17 @@ namespace MCTGLib
get => picture; get => picture;
set set
{ {
picture = value; if (string.IsNullOrWhiteSpace(value))
if (picture == null)
{ {
picture = "PhotoParDefaut"; throw new ArgumentNullException("Erreur pour la photo d'utilisateur!");
} }
}
} }
/// <summary> /// <summary>
/// Property to get Name of users, without setter because we don't want users /// Property to get Name of users and a setter
/// to change their Name.
/// </summary> /// </summary>
/// <exception cref="ArgumentNullException" >Setter have Exception which is trigger when Name is null</exception>
public string Name public string Name
{ {
get { return name; } get { return name; }
@ -52,15 +51,26 @@ namespace MCTGLib
{ {
if (string.IsNullOrWhiteSpace(value)) if (string.IsNullOrWhiteSpace(value))
{ {
throw new ArgumentNullException(); throw new ArgumentNullException("Il y a une erreur de Nom d'utilisateur!");
} }
name = value; name = value;
} }
} }
/// <summary>
/// Property to get Surname of users and a setter
/// </summary>
/// <exception cref="ArgumentNullException" >Setter have Exception which is trigger when Surname is null</exception>
public string Surname public string Surname
{ {
get { return surname; } get { return surname; }
private set { surname = value; } private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentNullException("Il y a une erreur de Prénom d'utilisateur");
}
surname = value;
}
} }
public string Mail public string Mail
{ {

Loading…
Cancel
Save