public ScoreBoardServiceTest() { MatchInitialize initialize = new MatchInitialize(); _currentMatch = initialize.GetCurrentMatchDetails(); striker = _currentMatch.Players.First(t => t.IsOnField); nonStriker = _currentMatch.Players.Last(t => t.IsOnField); _currentMatch.BallsRemaining = _currentMatch.OversLeft * 6; }
public MatchServiceTest() { _playerScoreHelper = new Mock <IPlayerScoreHelper>(); MatchInitialize initialize = new MatchInitialize(); _currentMatch = initialize.GetCurrentMatchDetails(); striker = _currentMatch.Players.First(t => t.IsOnField); nonStriker = _currentMatch.Players.Last(t => t.IsOnField); _currentMatch.BallsRemaining = _currentMatch.OversLeft * 6; target = new MatchService(_playerScoreHelper.Object); }
public IEnumerable <CurrentMatchDetails> GetCurrentMatchDetails() { List <CurrentMatchDetails> matchList = new List <CurrentMatchDetails>(); string res = ""; try { QLEntities objEntity = new QLEntities(); using (var connection = objEntity.Database.Connection) { if (connection.State != ConnectionState.Open) { connection.Open(); } SqlCommand command = new SqlCommand(); command.Connection = (SqlConnection)(connection); command.CommandText = string.Format("exec SP_QL_GetCurrentPredictionMatchDetails"); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var matchDetails = new CurrentMatchDetails(); matchDetails.MatchFixtureId = Convert.ToInt32(reader["MatchFixtureId"]); matchDetails.Team1Id = Convert.ToInt32(reader["Team1Id"]); matchDetails.Team2Id = Convert.ToInt32(reader["Team2Id"]); matchDetails.Team1Name = reader["Team1Name"].ToString(); matchDetails.Team2Name = reader["Team2Name"].ToString(); matchDetails.MatchDate = reader["MatchDate"].ToString(); matchList.Add(matchDetails); } } } } catch (Exception ex) { res = ex.ToString(); } return(matchList); }