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"))); }
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)); }
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)); }
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)); }
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); }
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)); }
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); }
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); }
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); }
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); }