public void ReturnsAdjustmentWithCorrectQuantity(decimal inputQuantity, decimal resultQuantity)
            {
                var resourceAdjustmentFactory = new ResourceAdjustmentFactory();

                var adjustment = resourceAdjustmentFactory.CreateDecreaseEqualTo(inputQuantity);

                Assert.That(adjustment.Quantity, Is.EqualTo(resultQuantity));
            }
Exemple #2
0
        public void Upgrade()
        {
            if (!CanBeUpgraded)
            {
                throw new UpgradeException("Insufficient resources");
            }

            var adjustment = _adjustmentFactory.CreateDecreaseEqualTo(UpgradeCost);

            // For now ensure level is adjusted before the resource cache is updated
            // to keep the UI responsive as updates only trigger off the back of resource
            // updates currently.
            Level++;
            _resourceCache.Apply(adjustment);
        }