Finished scoring system and started tests

This commit is contained in:
KäseToatz
2024-11-06 21:46:37 +01:00
parent 23ae45ba91
commit af7457a9d9
13 changed files with 265 additions and 50 deletions

36
Memory.Test/GameTest.cs Normal file
View File

@ -0,0 +1,36 @@
using Memory.Logic;
using Memory.Data;
namespace Memory.Test
{
[TestClass]
public class GameTest
{
[TestMethod]
public void IncreaseScore_QuarterTime_ShouldEqual75PercentOfPoints()
{
int score = (int)(Game.MAXPOINTS * 0.75);
Game game = new(new ScoreHandler());
Thread.Sleep(Game.MAXTIME / 4);
game.IncreaseScore();
Assert.IsTrue(score - 1 <= game.Score && score + 1 >= game.Score);
}
[TestMethod]
public void IncreaseScore_TooLong_ShouldEqualLowerBoundOfPoints()
{
Game game = new(new ScoreHandler());
Thread.Sleep(Game.MAXTIME);
game.IncreaseScore();
Assert.AreEqual(Game.MINPOINTS, game.Score);
}
[TestMethod]
public void IncreaseScore_Instant_ShouldEqualUpperBoundOfPoints()
{
Game game = new(new ScoreHandler());
game.IncreaseScore();
Assert.AreEqual(Game.MAXPOINTS, game.Score);
}
}
}