Пример #1
0
        public void MarkAsComplete_AlreadyComplete_ThrowsException()
        {
            var repo             = new Mock <IBetRepository>();
            var bookie           = new BookMaker(repo.Object);
            var completedOutcome = new BetOption()
            {
                Id  = 1,
                Bet = new Bet()
                {
                    Id = 1, Complete = true
                }
            };

            Assert.Throws <Exception>(() => bookie.MarkAsComplete(completedOutcome, ValidBettor));
        }
Пример #2
0
        public void MarkAsComplete_Valid_MarksBetAsComplete_AndAddsPoints()
        {
            var repo    = new Mock <IBetRepository>();
            var bookie  = new BookMaker(repo.Object);
            var outcome = new BetOption()
            {
                Id  = 1,
                Bet = new Bet()
                {
                    Id = 1
                }
            };

            bookie.MarkAsComplete(outcome, ValidBettor);
            repo.Verify(m => m.MarkComplete(It.IsAny <Bet>(), It.IsAny <Bettor>()));
            repo.Verify(m => m.MarkCorrect(It.IsAny <BetOption>()));
            repo.Verify(m => m.AddPointsToSuccessfulGuess(It.IsAny <BetOption>(), It.IsAny <long>()));
        }
Пример #3
0
        public void MarkAsComplete_DefaultBettor_ThrowsArgumentException()
        {
            var bookie = new BookMaker();

            Assert.Throws <ArgumentException>(() => bookie.MarkAsComplete(ValidBetOption, new Bettor()));
        }
Пример #4
0
        public void MarkAsComplete_NullBettor_ThrowsNullException()
        {
            var bookie = new BookMaker();

            Assert.Throws <ArgumentNullException>(() => bookie.MarkAsComplete(ValidBetOption, null));
        }