示例#1
0
        public void AddBet_ShouldThrowArgumentNullException_withNullBet()
        {
            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            Assert.That(
                () => match.AddBet(null),
                Throws.ArgumentNullException.With.Message.Contains(string.Format(EngineConstants.ObjectCannotBeNullErrorMessage, "Bet")));
        }
示例#2
0
        public void AddBet_ShouldAddCorrectToCollection_withValidParams()
        {
            var mockedBet = new Mock <IBet>();
            var match     = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            match.AddBet(mockedBet.Object);

            Assert.IsTrue(match.Bets.Contains(mockedBet.Object));
        }
示例#3
0
        public void AddResult_ShouldAddCorrectToCollection_withValidParams()
        {
            var mockedResult = new Mock <IResult>();

            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            match.AddResult(ResultType.Final, mockedResult.Object);

            Assert.IsTrue(match.Results.ContainsValue(mockedResult.Object));
        }
示例#4
0
        public void AddBet_ShouldThrowArgumentException_withBetSameBetsAdded()
        {
            var match     = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);
            var mockedBet = new Mock <IBet>();

            match.AddBet(mockedBet.Object);

            Assert.That(
                () => match.AddBet(mockedBet.Object),
                Throws.ArgumentException.With.Message.Contains(EngineConstants.SameBetsForAMatchErrorMessage));
        }
示例#5
0
        public void RemoveBet_ShouldThrowArgumentException_WhenTryingToRemoveExistingBet()
        {
            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            match.Bets.Add(this.mockedBet);

            Assert.AreEqual(1, match.Bets.Count);

            match.RemoveBet(this.mockedBet);

            Assert.AreEqual(0, match.Bets.Count);
        }
示例#6
0
        public void AddResult_ShouldThrowArgumentException_withTwoSameResults()
        {
            var mockedResult = new Mock <IResult>();
            var resultType   = ResultType.Final;

            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            match.AddResult(resultType, mockedResult.Object);

            Assert.That(
                () => match.AddResult(resultType, mockedResult.Object),
                Throws.ArgumentException.With.Message.Contains(EngineConstants.SameBetResultssForAMatchErrorMessage));
        }
示例#7
0
        public void GetId_ShouldSetCorrectlyUniqueIds_withValidParams()
        {
            var mockedBet = new Mock <IBet>();

            var firstMatch  = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(4), this.homeTeam, this.visitorTeam);
            var secondMatch = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(9), this.homeTeam, this.visitorTeam);
            var thirdMatch  = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(14), this.homeTeam, this.visitorTeam);

            var startId = firstMatch.Id;

            Assert.AreEqual(startId, firstMatch.Id);
            Assert.AreEqual(startId + 1, secondMatch.Id);
            Assert.AreEqual(startId + 2, thirdMatch.Id);
        }
示例#8
0
        public void GetVisitorTeam_CorrectlySetVisitorTeamByConstructor()
        {
            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            Assert.AreEqual(this.visitorTeam, match.VisitorTeam);
        }
示例#9
0
        public void GetDate_CorrectlySetDateByConstructor()
        {
            var match = new Logic.Models.Match(this.sport, this.league, this.date, this.homeTeam, this.visitorTeam);

            Assert.AreEqual(this.date, match.Date);
        }
示例#10
0
        public void Controller_ShouldPass_WithValidParams()
        {
            var match = new Logic.Models.Match(this.sport, this.league, this.date.AddDays(5), this.homeTeam, this.visitorTeam);

            Assert.IsInstanceOf <Logic.Models.Match>(match);
        }