using GameHandler.DeathGame; using GameModel; using GameModel.Exceptions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GameHandler.UnitTests { [TestFixture] internal class GameServiceTests { [Test] public void Start_InvalidStartStatusThrowInvalidGameStateExcpetion() { GameService service = new GameService(); service.Start(); Assert.That(() => service.Start(), Throws.TypeOf()); } [Test] public void Stop_InvalidStopStatusThrowInvalidGameStateExcpetion() { GameService service = new GameService(); Assert.That(() => service.Stop(), Throws.TypeOf()); } [Test] public void HandleThrow_NotPossibleBeforeStart() { GameService service = new GameService(); Assert.That(() => service.HandleThrow(null), Throws.TypeOf()); } [Test] public void HandleThrow_NotPossibleAfterStop() { GameService service = new GameService(); service.Start(); service.Stop(); Assert.That(() => service.HandleThrow(null), Throws.TypeOf()); } [Test] public void HandleThrow_UpdatesTheBoardState() { GameService service = new GameService(); var ts1 = service.Start(DeathGameHandler.GAMENAME_DEATHBOX); var bs1 = ts1.BoardState; var pinThrow = PinThrow.Create(1,PinPicture.Create(1,PinState.Down), false, false); var ts2 = service.HandleThrow(pinThrow); var bs2 = ts2.BoardState; Assert.That(bs2, Is.Not.EqualTo(bs1)); } } }