Exemplo n.º 1
0
        public void Move_SubtractsOneFromRemainingMovesPerTileMoved(IUnit<Archer> unit,
                                                                           ITile destination,
                                                                           int expectedRemainingMoves)
        {
            // :::: ARRANGE ::::
            var costlyUnit = new MoveCosts<Archer>(unit);

            // :::: ACT ::::
            costlyUnit.MoveTo(destination);

            // :::: ASSERT ::::
            costlyUnit.RemainingMoves.Should().Be(expectedRemainingMoves);
        }
Exemplo n.º 2
0
        public void MoveTo_IsForwardedAfterSubtractingMoveCostsFromTheRemainingMovesOfTheUnit()
        {
            // :::: ARRANGE ::::
            var spyUnit = A.Fake<IUnit<Archer>>();
            var costlyUnit = new MoveCosts<Archer>(spyUnit);

            using (var scope = Fake.CreateScope())
            {
                // :::: ACT ::::
                costlyUnit.MoveTo(DummyPosition);

                // :::: ASSERT ::::
                using (scope.OrderedAssertions())
                {
                    // The setter of RemainingMoves has been invoked.
                    A.CallTo(spyUnit).Where(x => x.Method.Name == $"set_{nameof(spyUnit.RemainingMoves)}")
                     .MustHaveHappened();

                    A.CallTo(() => spyUnit.MoveTo(DummyPosition)).MustHaveHappened();
                }
            }
        }