using GameModel; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GameHandler.UnitTests { [TestFixture] public class ThrowHandlerTests { ThrowHandler _th; [SetUp] public void SetUp() { _th = new ThrowHandler(); } [Test] public void CreateFullPicAfterEachThrowInRepositionMode() { var bs = _th.Init(ThrowMode.Reposition); var bs2 = _th.Update(bs, new PinThrow(1, PinPicture.Create(2,PinState.Down),false,false)); Assert.That(bs.PinPicture.UpCount, Is.EqualTo(9)); } [Test] public void SinkThrowReturnsSameGameStateAsBefore() { var bs = _th.Init(ThrowMode.Reposition); var bs2 = _th.Update(bs, new PinThrow(1, PinPicture.Create(2, PinState.Down), false, false)); var bs3 = _th.Update(bs, new PinThrow(1, PinPicture.Create(2, PinState.Down), false, true)); Assert.That(bs2, Is.EqualTo(bs3)); } [Test] public void CreateFullPicAfterBoardIsClearedInDecreaseMode() { var bs = _th.Init(ThrowMode.Decrease); var bs2 = _th.Update(bs, new PinThrow(1, PinPicture.Create(2, PinState.Down), false, false)); Assert.That(bs2.PinPicture.DownCount, Is.EqualTo(1)); var bs3 = _th.Update(bs, new PinThrow(1, PinPicture.CreateAllPins(), false, false)); Assert.That(bs3.PinPicture.DownCount, Is.EqualTo(0)); } } }