45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using GameHandler.GameHandler;
|
|
using GameModel;
|
|
using GameModel.FreeGame;
|
|
using NuGet.Frameworks;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace GameHandler.UnitTests.GameHandler
|
|
{
|
|
[TestFixture]
|
|
internal class FreeGameHandlerTests
|
|
{
|
|
private FreeGameHandler _gh;
|
|
|
|
[SetUp]
|
|
public void SetUp()
|
|
{
|
|
_gh = new FreeGameHandler();
|
|
}
|
|
|
|
[Test]
|
|
public void Init_ReturnsModelWithThrowModelPerPlayer()
|
|
{
|
|
var model = _gh.InitGameModel(new[] { 1, 2, 3, 4 }, null) as FreeGameModel;
|
|
Assert.That(model, Is.Not.Null);
|
|
Assert.That(model.Throws.Count(), Is.EqualTo(4));
|
|
}
|
|
|
|
[Test]
|
|
public void Update_ThrowsExceptionWhenModelIsNull()
|
|
{
|
|
Assert.That(() => _gh.Update(PinThrow.Create(2, false, true), null, BoardState.Create()), Throws.TypeOf<ArgumentNullException>());
|
|
}
|
|
|
|
[Test]
|
|
public void Update_ThrowsExceptionWhenModelIsNotInitialized()
|
|
{
|
|
Assert.That(() => _gh.Update(PinThrow.Create(2, false, true), new FreeGameModel(null,0,Array.Empty<FreeGameThrow>()), BoardState.Create()), Throws.TypeOf<FreeGameThrowExcepetion>());
|
|
}
|
|
}
|
|
}
|