plus simple
All checks were successful
Main Build Process / Build & Test (pull_request) Successful in 1m42s
check main state / build (8.0.x) (push) Successful in 55s
Main Build Process / Build & Test (push) Successful in 1m23s

This commit was merged in pull request #13.
This commit is contained in:
2024-09-03 20:59:49 +02:00
parent 4a5fc49c31
commit 0503e95d64
6 changed files with 21 additions and 69 deletions

View File

@@ -17,6 +17,7 @@ public class MatchTesting
Match match2 = new Match(getter);
match2.AddPlayer("Player1");
match2.AddPlayer("Player2");
Assert.Throws<MatchConfigException>(() => match2.AddPlayer("Player2"));
match2.Init();
Match match3 = new Match(getter);
@@ -51,10 +52,23 @@ public class MatchTesting
PlayerZone player1 = match.GetPlayerZone("Player1");
PlayerZone player1_3 = match.GetPlayerZone("Player2");
Assert.Equal(3, player1.Ressources[Enums.ResourceType.Piece]);
player1.AddRessources(ResourceType.Piece, 1);
Assert.Equal(3, player1_3.Ressources[Enums.ResourceType.Piece]);
Assert.Equal(4, player1.Objectives.Count);
}
[Fact]
public void MatchGetters()
{
StaticDataGetter getter = new();
Match match = new Match(getter);
match.AddPlayer("Player1");
match.AddPlayer("Player2");
match.Init();
Assert.Throws<ArgumentException>(() => match.GetPlayerZone("UnknownPlayer"));
}
}

View File

@@ -1,36 +0,0 @@
using LittleTown.Core.Actions;
using LittleTown.StaticDataAcces;
namespace LittleTown.Core.Tests;
public class MatchUpdaterTesting
{
private class TestAction : IAction
{
public Action<MatchUpdater> CB { get; init; } = delegate { };
public void Execute(MatchUpdater updater)
{
CB(updater);
}
}
[Fact]
public void EnforcePlayerCountInMatchCreation()
{
StaticDataGetter getter = new StaticDataGetter();
Match match = new Match(getter);
match.AddPlayer("Player1");
match.AddPlayer("Player2");
match.Init();
TestAction ta = new TestAction()
{
CB = (updater) =>
{
Assert.True(updater.GetMatch() == match);
}
};
}
}