public void MoveTo_IsNotForwarded_BecauseTheUnitBelongsToAnOpponent(ITurnTaking turnTaking, Player owner)
        {
            // :::: ARRANGE ::::
            var spyUnit = A.Fake<IUnit<Archer>>();
            var managedUnit = new FriendlyUnitManagementOnly<Archer>(spyUnit, turnTaking);

            A.CallTo(() => spyUnit.Owner).Returns(owner);

            // :::: ACT ::::
            managedUnit.MoveTo(DummyTile);

            // :::: ASSERT ::::
            A.CallTo(() => spyUnit.MoveTo(A<ITile>._)).MustNotHaveHappened();
        }
        public void PerformAction_IsForwarded_BecauseTheUnitBelongsToThePlayerInTurn(ITurnTaking turnTaking,
                                                                                     Player owner)
        {
            // :::: ARRANGE ::::
            var spyUnit = A.Fake<IUnit<Archer>>();
            var managedUnit = new FriendlyUnitManagementOnly<Archer>(spyUnit, turnTaking);

            A.CallTo(() => spyUnit.Owner).Returns(owner);

            // :::: ACT ::::
            managedUnit.PerformAction();

            // :::: ASSERT ::::
            A.CallTo(() => spyUnit.PerformAction()).MustHaveHappened();
        }
Exemplo n.º 3
0
 public ExtenCivGame(ICityLayer cityLayer,
                     ITerrainLayer terrainLayer,
                     IUnitLayer unitLayer,
                     ITurnTaking turnTaking,
                     IWorldAge worldAge,
                     IWinnerStrategy winnerStrategy,
                     IDictionary<string, IProductionProject> productionProjects)
 {
     this.cityLayer = cityLayer;
     this.terrainLayer = terrainLayer;
     this.unitLayer = unitLayer;
     this.turnTaking = turnTaking;
     this.worldAge = worldAge;
     this.winnerStrategy = winnerStrategy;
     this.productionProjects = productionProjects;
 }
        public void SetProductionProject_IsNotForwarded_BecauseTheCityBelongsToAnOpponent(ITurnTaking turnTaking,
                                                                                          Player owner)
        {
            // :::: ARRANGE ::::
            var spyCity = A.Fake<ICity<City>>();
            var managedCity = new FriendlyCityManagementOnly<City>(spyCity, turnTaking);

            A.CallTo(() => spyCity.Owner).Returns(owner);

            // :::: ACT ::::
            managedCity.ProductionProject = DummyProject;

            // :::: ASSERT ::::
            // The setter of ProductionProject has not been invoked.
            A.CallTo(spyCity)
             .Where(x => x.Method.Name == $"set_{nameof(spyCity.ProductionProject)}").MustNotHaveHappened();
        }