Esempio n. 1
0
        public void When_ListIsEmpty_Then_ShouldReturnNull(int num)
        {
            List <int> a = new List <int>();

            PairFinder pf = new PairFinder(a);

            Assert.IsNull(pf.FindPairForNum(num));
        }
Esempio n. 2
0
        public void Return_An_Empty_Pair_When_Given_An_Empty_List()
        {
            var persons = new List <Person>();
            var finder  = new PairFinder(persons);

            var result = finder.FindPair(Filter.ClosestAge);

            Assert.Null(result.OldestPerson);
            Assert.Null(result.YoungestPerson);
        }
Esempio n. 3
0
        public void When_NegativeMatchFound_Then_ShouldReturnNull()
        {
            List <int> a = new List <int> {
                -5, -2
            };

            PairFinder pf = new PairFinder(a);

            Assert.IsNotNull(pf.FindPairForNum(-7));
        }
Esempio n. 4
0
        public void When_PositiveMatchFound_Then_ShouldReturnNull()
        {
            List <int> a = new List <int> {
                1, 2
            };

            PairFinder pf = new PairFinder(a);

            Assert.IsNotNull(pf.FindPairForNum(3));
        }
Esempio n. 5
0
        public int SelectBetFor3Cards(Card[] cards)
        {
            var triple = new TripleFinder().GetTriple(cards);

            if (triple > 0)
            {
                return((int)(2 * triple * _state.current_buy_in));
            }

            var pairFinder = new PairFinder();

            return(pairFinder.GetPairPower(cards) > 0.5 ? (int)(pairFinder.GetPairPower(cards) * 2 * _state.current_buy_in) : 0);
        }
Esempio n. 6
0
        public void Returns_The_Closest_Age_Pair_For_Four_People_List()
        {
            var persons = new List <Person>()
            {
                _greg, _mike, _sarah, _sue
            };
            var finder = new PairFinder(persons);

            var result = finder.FindPair(Filter.ClosestAge);

            Assert.Same(_sue, result.OldestPerson);
            Assert.Same(_greg, result.YoungestPerson);
        }