1 Commits

Author SHA1 Message Date
e918b26d6c ajout d'un peu de couverture de code
Some checks failed
check main state / build (8.0.x) (push) Failing after 1m17s
Main Build Process / Build & Test (pull_request) Failing after 1m44s
2024-08-29 23:49:14 +02:00

View File

@@ -1,6 +1,5 @@
using System.Reflection;
using System.Text.Json;
using AutoMapper.Internal;
using LittleTown.Core.Exceptions;
using LittleTown.StaticDataAcces;
@@ -18,4 +17,21 @@ public class ExceptionTesting
Assert.Throws<JsonException>(() => getter.GetObjectives());
Assert.Throws<JsonException>(() => getter.GetBuildings());
}
[Fact]
public void NombreDeJoueurMauvaisDansMatch()
{
StaticDataGetter getter = new();
Match match2Player = new Match(getter);
match2Player.AddPlayer("Player1");
match2Player.AddPlayer("Player2");
Type type = match2Player.GetType();
PropertyInfo? prop = type?.BaseType?.GetProperty("_players");
prop?.SetValue(match2Player, new Dictionary<string, PlayerZone>(), null);
Assert.Throws<MatchConfigException>(() => match2Player.Init());
}
}