Пример #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);
        }