|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection.Emit;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Models.Game;
|
|
|
|
@ -12,7 +13,11 @@ namespace Tests
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Constructor_WithNegativeInputs_SetsPropertiesToZero()
|
|
|
|
|
{
|
|
|
|
|
var bestScore = new BestScore(-5, -10);
|
|
|
|
|
var myMap = new Map("Dunai", "Dunai.png");
|
|
|
|
|
var myPlayer = new Player("John", "pp.png");
|
|
|
|
|
|
|
|
|
|
var bestScore = new BestScore(myMap.Name, myPlayer, -5, -10);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(0, bestScore.GamesPlayed);
|
|
|
|
|
Assert.Equal(0, bestScore.Score);
|
|
|
|
|
}
|
|
|
|
@ -20,7 +25,11 @@ namespace Tests
|
|
|
|
|
[Fact]
|
|
|
|
|
public void Constructor_WithPositiveInputs_SetsPropertiesCorrectly()
|
|
|
|
|
{
|
|
|
|
|
var bestScore = new BestScore(5, 10);
|
|
|
|
|
var myMap = new Map("Dunai", "Dunai.png");
|
|
|
|
|
var myPlayer = new Player("John", "pp.png");
|
|
|
|
|
|
|
|
|
|
var bestScore = new BestScore(myMap.Name, myPlayer, 5, 10);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(5, bestScore.GamesPlayed);
|
|
|
|
|
Assert.Equal(10, bestScore.Score);
|
|
|
|
|
}
|
|
|
|
@ -28,24 +37,36 @@ namespace Tests
|
|
|
|
|
[Fact]
|
|
|
|
|
public void IncrGamesPlayed_IncrementsGamesPlayed()
|
|
|
|
|
{
|
|
|
|
|
var bestScore = new BestScore(0, 0);
|
|
|
|
|
var myMap = new Map("Dunai", "Dunai.png");
|
|
|
|
|
var myPlayer = new Player("John", "pp.png");
|
|
|
|
|
|
|
|
|
|
var bestScore = new BestScore(myMap.Name, myPlayer, 0, 0);
|
|
|
|
|
bestScore.IncrGamesPlayed();
|
|
|
|
|
|
|
|
|
|
Assert.Equal(1, bestScore.GamesPlayed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ScoreSetter_WithLowerValue_DoesNotChangeScore()
|
|
|
|
|
{
|
|
|
|
|
var bestScore = new BestScore(0, 10);
|
|
|
|
|
var myMap = new Map("Dunai", "Dunai.png");
|
|
|
|
|
var myPlayer = new Player("John", "pp.png");
|
|
|
|
|
|
|
|
|
|
var bestScore = new BestScore(myMap.Name, myPlayer, 0, 10);
|
|
|
|
|
bestScore.UpdateScore(5);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(5, bestScore.Score);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ScoreSetter_WithHigherValue_ChangesScore()
|
|
|
|
|
{
|
|
|
|
|
var bestScore = new BestScore(0, 5);
|
|
|
|
|
var myMap = new Map("Dunai", "Dunai.png");
|
|
|
|
|
var myPlayer = new Player("John", "pp.png");
|
|
|
|
|
|
|
|
|
|
var bestScore = new BestScore(myMap.Name, myPlayer, 0, 5);
|
|
|
|
|
bestScore.UpdateScore(10);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(10, bestScore.Score);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|