Ejemplo n.º 1
0
        public void DefuseAttempt_ShouldPickARandomBombId()
        {
            // Given
            const int    nbBombsDefused = 5;
            const string pickedBombId   = "RandomBombPicked";
            var          players        = new List <Player>().AsReadOnly();

            _allBombs.PickRandomBombId(nbBombsDefused)
            .Returns(pickedBombId);

            // When
            var defuseAttempt = new DefuseAttempt(_random, _defuserCounter, _allBombs, players, nbBombsDefused);

            // Then
            Assert.That(defuseAttempt.BombId, Is.EqualTo(pickedBombId));
        }
Ejemplo n.º 2
0
        public void PickRandomBombId_ShouldReturnABombFilteredByItsLanguage()
        {
            // Given
            _random.Range(0, 4)
            .Returns(3);

            _deviceInfo.GetDeviceBombLanguage()
            .Returns(BombLanguage.French);

            _allBombs = new AllBombs(_random, _bombs, _deviceInfo);

            // When
            var randomBombId = _allBombs.PickRandomBombId(2);

            // Then
            Assert.That(randomBombId, Is.EqualTo("bomb4_fr"));
        }
Ejemplo n.º 3
0
        public void PickRandomBombId_ShouldReturnABombFilteredByNbBombsDefused()
        {
            // Given
            _random.Range(0, 2)
            .Returns(1);

            _deviceInfo.GetDeviceBombLanguage()
            .Returns(BombLanguage.None);

            _allBombs = new AllBombs(_random, _bombs, _deviceInfo);

            // When
            var randomBombId = _allBombs.PickRandomBombId(1);

            // Then
            Assert.That(randomBombId, Is.EqualTo("bomb2"));
        }