コード例 #1
0
        public void TheCostOfTheUnit_IsDeductedFromTheProductionTreasury(ICity<City> city, int rounds)
        {
            // :::: ARRANGE ::::
            var stubUnits = StubWorld.NoUnits;
            var stubNotifier = A.Fake<INotifyBeginningNextRound>();
            var accumulatingCity = new ProductionAccumulation<City>(city, stubUnits, stubNotifier);

            // :::: ACT ::::
            rounds.Times(() => stubNotifier.BeginningNextRound += Raise.With(DummyEventArgs));

            // :::: ASSERT ::::
            var expectedTreasury = rounds * city.GeneratedProduction - city.ProductionProject.Cost;
            accumulatingCity.ProductionTreasury.Should().Be(expectedTreasury);
        }
コード例 #2
0
        public void Units_DoNotSpawnOnTheCityTile(ICity<City> city, IUnit existingUnit)
        {
            // :::: ARRANGE ::::
            var stubUnits = StubWorld.Units(new[] { existingUnit });
            var stubNotifier = A.Fake<INotifyBeginningNextRound>();
            var accumulatingCity = new ProductionAccumulation<City>(city, stubUnits, stubNotifier);

            // :::: ACT ::::
            stubNotifier.BeginningNextRound += Raise.With(DummyEventArgs);

            // :::: ASSERT ::::
            stubUnits.Should().HaveCount(1);
        }
コード例 #3
0
        public void ProductionCost_IsNotDeductedFromTheProductionTreasury(ICity<City> city, IUnit existingUnit)
        {
            // :::: ARRANGE ::::
            var stubUnits = StubWorld.Units(new[] { existingUnit });
            var stubNotifier = A.Fake<INotifyBeginningNextRound>();
            var accumulatingCity = new ProductionAccumulation<City>(city, stubUnits, stubNotifier);

            // :::: ACT ::::
            stubNotifier.BeginningNextRound += Raise.With(DummyEventArgs);

            // :::: ASSERT ::::
            accumulatingCity.ProductionTreasury.Should().BeGreaterOrEqualTo(accumulatingCity.ProductionProject.Cost);
        }
コード例 #4
0
        public void TheUnit_IsPlacedOnTheCityTile_AndBelongsToTheCityOwner(ICity<City> city, Type expectedType)
        {
            // :::: ARRANGE ::::
            var stubUnits = StubWorld.NoUnits;
            var stubNotifier = A.Fake<INotifyBeginningNextRound>();
            var accumulatingCity = new ProductionAccumulation<City>(city, stubUnits, stubNotifier);

            // :::: ACT ::::
            stubNotifier.BeginningNextRound += Raise.With(DummyEventArgs);

            // :::: ASSERT ::::
            var newlyProducedUnit = stubUnits.Single();

            newlyProducedUnit.Should().BeOfType(expectedType);
            newlyProducedUnit.Owner.Should().Be(accumulatingCity.Owner);
            newlyProducedUnit.Location.Should().Be(accumulatingCity.Location);
        }