Fix : 1v1 code smells

Popup_qui_marche_pas
Jade VAN BRABANDT 2 years ago
parent 313f69f1de
commit 5a8e48cc4f

@ -31,7 +31,7 @@ namespace Model
get => description;
private set
{
if (string.IsNullOrWhiteSpace(value)) return;
if (string.IsNullOrWhiteSpace(value)) description="Defaut";
else
{
description = value;
@ -47,7 +47,7 @@ namespace Model
get => year;
private set
{
if (value < 1957 || value > 2023) return;
if (value < 1957 || value > 2023) year=2023;
else
{
year = value;
@ -79,7 +79,7 @@ namespace Model
get => tags;
private set
{
if (value == null || value.Count > 3) return;
if (value == null || value.Count > 3) tags = new ObservableCollection<string>();
else
{
tags = value;
@ -104,7 +104,7 @@ namespace Model
get => lien;
private set
{
if (string.IsNullOrWhiteSpace(value)) return;
if (string.IsNullOrWhiteSpace(value)) lien = "Pas de lien";
else
{
lien = value;

@ -7,7 +7,7 @@ namespace Model
{
private readonly IPersistance mgrpersistance;
public IReadOnlyList<Game> GameList => gameList.AsReadOnly();
private List<Game> gameList;
private readonly List<Game> gameList;
public Game? SelectedGame { get; set; }
public User? CurrentUser { get; set; }
public HashSet<User> Users { get; private set; }

@ -120,6 +120,15 @@ namespace Model
if (string.IsNullOrWhiteSpace(Username)) return false;
return other != null && Username.Equals(other.Username);
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return this.Equals((User)obj);
}
public override int GetHashCode()
{
if (Username!=null) return Username.GetHashCode();
@ -152,14 +161,6 @@ namespace Model
Followed_Games.Remove(game);
}
public override bool Equals(object? obj)
{
if (obj == null) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return this.Equals((User)obj);
}
public override string ToString()
{
StringBuilder builder = new();

@ -7,7 +7,12 @@ namespace StimStub
[ExcludeFromCodeCoverage]
public class Stub : IPersistance
{
public List<Game> Games = new();
public List<Game> Games
{
get { return games; }
set { games = value; }
}
private List<Game> games;
public Stub()
{

Loading…
Cancel
Save