You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
53 lines
1.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Models.Game;
|
|
|
|
namespace Tests
|
|
{
|
|
public class BestScoreTests
|
|
{
|
|
[Fact]
|
|
public void Constructor_WithNegativeInputs_SetsPropertiesToZero()
|
|
{
|
|
var bestScore = new BestScore(-5, -10);
|
|
Assert.Equal(0, bestScore.GamesPlayed);
|
|
Assert.Equal(0, bestScore.Score);
|
|
}
|
|
|
|
[Fact]
|
|
public void Constructor_WithPositiveInputs_SetsPropertiesCorrectly()
|
|
{
|
|
var bestScore = new BestScore(5, 10);
|
|
Assert.Equal(5, bestScore.GamesPlayed);
|
|
Assert.Equal(10, bestScore.Score);
|
|
}
|
|
|
|
[Fact]
|
|
public void IncrGamesPlayed_IncrementsGamesPlayed()
|
|
{
|
|
var bestScore = new BestScore(0, 0);
|
|
bestScore.IncrGamesPlayed();
|
|
Assert.Equal(1, bestScore.GamesPlayed);
|
|
}
|
|
|
|
[Fact]
|
|
public void ScoreSetter_WithLowerValue_DoesNotChangeScore()
|
|
{
|
|
var bestScore = new BestScore(0, 10);
|
|
bestScore.UpdateScore(5);
|
|
Assert.Equal(5, bestScore.Score);
|
|
}
|
|
|
|
[Fact]
|
|
public void ScoreSetter_WithHigherValue_ChangesScore()
|
|
{
|
|
var bestScore = new BestScore(0, 5);
|
|
bestScore.UpdateScore(10);
|
|
Assert.Equal(10, bestScore.Score);
|
|
}
|
|
}
|
|
}
|