Esempio n. 1
0
 public PlayersQuantityTypeShouldBase()
 {
     BetCards.AddRange(EnumerableGenerator.Generate(5, x => new Mock <IBetCard>().Object));
     ListOfPlayers = new List <Mock <IPlayer> > {
         PlayerOne, PlayerTwo, PlayerThree, PlayerFour, PlayerFive
     };
     ListOfPlayers.ForEach(x => x.Setup(s => s.GiveCard(It.IsAny <IBetCard>())));
 }
        public void Not_Allow_More_Neither_Less_Than_Five_Cards(int countOfCards)
        {
            Action act = () => _sut.GiveBetCards(new
                                                 ReadOnlyCollection <IBetCard>(EnumerableGenerator
                                                                               .Generate <IBetCard>(countOfCards, x => new Mock <IBetCard>().Object)));

            act.Should().Throw <ArgumentException>();
        }
Esempio n. 3
0
        public void GeneratesCorrectType(Type argumentType)
        {
            var generator = new EnumerableGenerator(elementGeneratorType: typeof(ConstantGenerator), elementGeneratorConstructorArguments: 42);
            var random    = new FuzzRandom();

            var generatedValue = generator.Generate(Mock.Of <IFuzzProfile>(), argumentType, random);

            Assert.IsInstanceOfType(generatedValue, argumentType);
        }
        public PlayerManagerShould()
        {
            _betCards = new ReadOnlyCollection <IBetCard>(EnumerableGenerator.Generate(5, x => new Mock <IBetCard>().Object));

            _mockgGenericMixStrategy.Setup(x => x.Mix <IBetCard>(It.IsAny <List <IBetCard> >()))
            .Returns(EnumerableGenerator.Generate(10, x => new Mock <IBetCard>().Object));

            _sut = new PlayersManager(_mockPlayers.Object, _mockRacingCardManager.Object, _mockgGenericMixStrategy.Object);
        }
Esempio n. 5
0
        public RacingCardsShould()
        {
            _racingCards = EnumerableGenerator.Generate <IRacingCard>(5, x =>
            {
                return(new Mock <IRacingCard>().Object);
            });

            _sut = Domain.RacingCards.RacingCards.Create(_racingCards);
        }
        public RacingCardOnDeskManagerShould()
        {
            _listOfRacing = new List <IRacingCard> {
                new Mock <IRacingCard>().Object, new Mock <IRacingCard>().Object, new Mock <IRacingCard>().Object
            };

            var returnList = EnumerableGenerator.Generate(1, x => new Mock <IRacingCard>().Object);

            _sut = new RacingCardOnDeskManager();
        }
Esempio n. 7
0
        public void DefaultsToProfileElementGenerator()
        {
            var generator = new EnumerableGenerator();
            var random    = new FuzzRandom();

            var profile = new Mock <IFuzzProfile>();

            profile.Setup(c => c.GeneratorFor(typeof(int))).Returns(new ConstantGenerator(42));

            var generatedValue = generator.Generate(profile.Object, typeof(IList <int>), random);

            Assert.IsInstanceOfType(generatedValue, typeof(IList <int>));
        }
        private void Return_Count_Of_Racing_Cards(int countOfCards)
        {
            var listOfRacingCards = EnumerableGenerator.Generate(countOfCards, x => new Mock <IRacingCard>().Object);

            _mockRacingCardsFactory.Setup(x => x.Create()).Returns(listOfRacingCards);
            _mockGenericMixStrategy.Setup(x => x.Mix <IRacingCard>(It.IsAny <List <IRacingCard> >()))
            .Returns(new ReadOnlyCollection <IRacingCard>(listOfRacingCards));

            _mockMixDiscartCards.Setup(x => x.MixAll())
            .Returns(new ReadOnlyCollection <IRacingCard>(listOfRacingCards));

            _sut = new RacingCardManager(_mockRacingCardsFactory.Object,
                                         _mockGenericMixStrategy.Object,
                                         _mockMixDiscartCards.Object);

            _sut.CountOfCards.Should().Be(countOfCards);
        }
Esempio n. 9
0
        private void Return_Numbers_In_Different_Position(int countOfValues)
        {
            var listOfRacingCards = EnumerableGenerator.Generate(countOfValues, (index) => index);

            listOfRacingCards.SequenceEqual(_sut.Mix(listOfRacingCards)).Should().Be(false);
        }