コード例 #1
0
        AssertThatGetCurrentBetsAndScheduledMatchesCallsFindBetsByUseAndReturnsOnlyScheduledBetsAndMatch()
        {
            _betDao.FindBetsByUser(Arg.Any <User>()).Returns(Task.FromResult(_betsByUser));
            _teamDao.FindTeam(Arg.Any <int>()).Returns(Task.FromResult(_team));
            _matchDao.FindMatch(Arg.Any <int>()).Returns(Task.FromResult(_matchScheduled));
            _matchDao.FindByStatus(Match.ScheduledStatus).Returns(Task.FromResult(_matchesScheduled));

            var currentBetsAndMatch = await _betManager.GetCurrentBetsAndScheduledMatches(_user, 2001);

            await _betDao.Received().FindBetsByUser(Arg.Any <User>());

            await _teamDao.Received().FindTeam(Arg.Any <int>());

            await _matchDao.Received().FindMatch(Arg.Any <int>());

            await _matchDao.Received().FindByStatus(Arg.Any <string>());

            var bets    = currentBetsAndMatch.Bets as List <Bet>;
            var matches = currentBetsAndMatch.Matches as List <Match>;

            Assert.IsNotEmpty(bets, "bets empty");
            Assert.IsTrue(bets.All(b => b.Match.Status == Match.ScheduledStatus));
            Assert.IsTrue(bets.All(b => b.Match.Competition.Id == 2001));

            Assert.IsNotEmpty(matches, "matches empty");
            Assert.IsTrue(matches.All(m => m.Status == Match.ScheduledStatus));
            Assert.IsTrue(matches.All(m => m.Competition.Id == 2001));
        }