Finished scoring system and started tests
This commit is contained in:
36
Memory.Test/GameTest.cs
Normal file
36
Memory.Test/GameTest.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user