diff --git a/Sources/Stim.Model/Game.cs b/Sources/Stim.Model/Game.cs index 800f092..3dcd37c 100644 --- a/Sources/Stim.Model/Game.cs +++ b/Sources/Stim.Model/Game.cs @@ -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(); 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; diff --git a/Sources/Stim.Model/Manager.cs b/Sources/Stim.Model/Manager.cs index 87db3e3..61e2ad3 100644 --- a/Sources/Stim.Model/Manager.cs +++ b/Sources/Stim.Model/Manager.cs @@ -7,7 +7,7 @@ namespace Model { private readonly IPersistance mgrpersistance; public IReadOnlyList GameList => gameList.AsReadOnly(); - private List gameList; + private readonly List gameList; public Game? SelectedGame { get; set; } public User? CurrentUser { get; set; } public HashSet Users { get; private set; } diff --git a/Sources/Stim.Model/User.cs b/Sources/Stim.Model/User.cs index 9988a45..10b5a63 100644 --- a/Sources/Stim.Model/User.cs +++ b/Sources/Stim.Model/User.cs @@ -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(); diff --git a/Sources/Stub/Stub.cs b/Sources/Stub/Stub.cs index 01337d0..8f7db88 100644 --- a/Sources/Stub/Stub.cs +++ b/Sources/Stub/Stub.cs @@ -7,7 +7,12 @@ namespace StimStub [ExcludeFromCodeCoverage] public class Stub : IPersistance { - public List Games = new(); + public List Games + { + get { return games; } + set { games = value; } + } + private List games; public Stub() {