Exemplo n.º 1
0
        public void Reload(int shooterId)
        {
            Shooter shooterToUpdate = _shooterRepository.GetById(shooterId);

            if (shooterToUpdate.Ammunitions > MaxLoadout)
            {
                throw new ArgumentException($"Maximum loadout is {MaxLoadout}.");
            }

            if (shooterToUpdate.Ammunitions >= MaxLoadout)
            {
                return;
            }

            shooterToUpdate.Ammunitions += 1;

            _shooterRepository.Save(shooterToUpdate);
        }
        public void SetUp()
        {
            _shooterRepo = Substitute.For <IShooterRepository>();

            _originalShooter = new Shooter()
            {
                Id = ShooterIdentifier
            };

            _shooterRepo.GetById(ShooterIdentifier).Returns(_originalShooter);
        }
        public void Explore()
        {
            // ARRANGE
            int shooterId = 10;

            Shooter original = new Shooter()
            {
                Id          = shooterId,
                Ammunitions = int.MaxValue
            };

            _shooterRepo.GetById(10).Returns(original);

            // ACT
            GetTarget().Reload(shooterId);

            Check.That(original.Ammunitions).IsEqualTo(int.MinValue);
        }