public void CanAddDivisionToLeague()
        {
            var request = new AddDivisionToLeagueRequest { DivisionId = "D1", LeagueId = "League" };
            var league = new League();
            _leagueRepo.Setup(x => x.GetById(request.LeagueId)).Returns(league);

            var response = _handle.Handle(request);

            Assert.That(response.Status, Is.EqualTo(ResponseCodes.Success));
            _leagueRepo.Verify(x => x.AddDivisionToLeague(league,
                request.DivisionId));
        }
        public void CanNotAddADivisionTwice()
        {
            var request = new AddDivisionToLeagueRequest { DivisionId = "D1", LeagueId = "League" };
            var league = new League();
            league.DivisionIds.Add(request.DivisionId);
            _leagueRepo.Setup(x => x.GetById(request.LeagueId)).Returns(league);

            var response = _handle.Handle(request);

            Assert.That(response.Status, Is.EqualTo(ResponseCodes.AlreadyInLeague));
            _leagueRepo.Verify(x => x.AddDivisionToLeague(league,
                request.DivisionId), Times.Never());
        }
Exemple #3
0
        public void HoldsAListOfSubLeagues()
        {
            var league = new League();

            Assert.That(league.DivisionIds, Is.Empty);
        }