Beispiel #1
0
        public void ShouldGetResults()
        {
            //given
            var dictionary = new Dictionary <string, object>
            {
                { "HomeTeam", "Arsenal" },
                { "AwayTeam", "Villa" },
                { "HomeScore", 3 },
                { "AwayScore", 0 },
                { "HomeTeamId", 1 },
                { "AwayTeamId", 2 },
                { "ResultId", Guid.NewGuid() },
            };

            var helper = new Mock <IDbHelper>();

            helper.Setup(x => x.ExecuteReader("up_RecentResults", null)).Returns(
                DataReaderTestHelper.Reader(dictionary));

            var repository = new ResultsRepository(helper.Object);

            //when
            var resultsModels = repository.GetResults();

            //then
            Assert.That(resultsModels.Count, Is.EqualTo(1));
            Assert.That(resultsModels.First().AwayScore, Is.EqualTo(0));
            Assert.That(resultsModels.First().AwayTeam, Is.EqualTo("Villa"));
            Assert.That(resultsModels.First().AwayTeamId, Is.EqualTo(2));
            Assert.That(resultsModels.First().HomeScore, Is.EqualTo(3));
            Assert.That(resultsModels.First().HomeTeam, Is.EqualTo("Arsenal"));
            Assert.That(resultsModels.First().HomeTeamId, Is.EqualTo(1));
            Assert.That(resultsModels.First().ResultId, Is.EqualTo(dictionary["ResultId"]));
        }
Beispiel #2
0
        private void ResultsForm_Load(object sender, EventArgs e)
        {
            Results results = new Results();

            results.LeagueName2            = Competitions.LeagueId;
            bindingSource.DataSource       = _resultsRepository.GetResults(results);
            dataGridViewResults.DataSource = bindingSource;

            dataGridViewResults.AutoGenerateColumns = false;

            dataGridViewResults.Columns["LeagueName"].Visible = false;

            lblCountryName.Text = Competitions.lblCountryName;
            lblLeagueName.Text  = Competitions.LeagueId;

            dataGridViewResults.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
            dataGridViewResults.EnableHeadersVisualStyles = false;
        }
Beispiel #3
0
        public ActionResult <IEnumerable <CompleteDataModel> > GetResults()
        {
            IEnumerable <CompleteDataModel> matches = _resultsRepository.GetResults();

            return(Ok(matches));
        }