Пример #1
0
        public void SortByTemperatureTest()
        {
            var client = GetClient();

            // this sort method only works when limited to a season, for some reason.
            var descendingOptions = new GamesRequestOptions {
                Sorts = new[] { new GameSort(GameSortTypes.Temperature, SortOrder.Descending) }
            };
            var gamesDescending = client.GetGames(season: 2015, options: descendingOptions);

            var ascendingOptions = new GamesRequestOptions {
                Sorts = new[] { new GameSort(GameSortTypes.Temperature, SortOrder.Ascending) }
            };
            var gamesAscending = client.GetGames(season: 2015, options: ascendingOptions);

            var highest = gamesDescending.FirstOrDefault()?.Weather?.Temperature;
            var lowest  = gamesAscending.FirstOrDefault()?.Weather?.Temperature;

            Assert.IsNotNull(highest, Endpoint.RequestClient.LastRequestUrl);
            Assert.IsNotNull(lowest, Endpoint.RequestClient.LastRequestUrl);

            var expected = true;
            var actual   = highest > lowest;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #2
0
        public void FilterByEventTypeTest()
        {
            var client = GetClient();

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.EventTypeId.In(EventTypeIds.Playoffs, EventTypeIds.GreyCup) }
            };

            var games = client.GetGames(season: 2015, options: options);

            var expected = 5;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #3
0
        public void FilterByEventTypeTest()
        {
            var client = GetClient();

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.EventTypeId.GreaterThan(EventTypeIds.RegularSeason) }
            };

            var games = client.GetGames(season: 2015, options: options);

            var expected = 5;
            var actual   = games.Where(g => g.EventType.EventTypeId > EventTypeIds.RegularSeason).Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #4
0
        public void WeekInTest()
        {
            var client = GetClient();

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Week.In(2, 9) }
            };

            var games = client.GetGames(options: options);

            var week2 = games.FirstOrDefault(g => g.Week == 2);
            var week9 = games.FirstOrDefault(g => g.Week == 9);

            Assert.IsNotNull(week2, Endpoint.RequestClient.LastRequestUrl);
            Assert.IsNotNull(week9, Endpoint.RequestClient.LastRequestUrl);
        }
        public void FilterByTemperatureTest()
        {
            var client = GetClient();

            var filterValue = 21;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Temperature.LessThanOrEqualTo(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().Weather.Temperature <= filterValue && games.Last().Weather.Temperature <= filterValue;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
        public void FilterByDateStartTest()
        {
            var client = GetClient();

            var filterValue = new DateTime(2015, 06, 08);

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.DateStart.LessThanOrEqualTo(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().DateStart <= filterValue && games.Last().DateStart <= filterValue;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
        public void FilterByTeam1Test()
        {
            var client = GetClient();

            var filterValue = TeamAbbreviations.Saskatchewan;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Team1.LessThanOrEqualTo(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = string.Compare(games.First().Team1.Abbreviation, filterValue) <= 0 && string.Compare(games.Last().Team1.Abbreviation, filterValue) <= 0;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #8
0
        public void FilterBySeasonTest()
        {
            var client = GetClient();

            var filterValue = 2014;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Season.LessThan(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().Season < filterValue && games.Last().Season < filterValue;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #9
0
        public void FilterByDateStartTest()
        {
            var client = GetClient();

            var filterValue = DateTime.SpecifyKind(new DateTime(2015, 06, 08, 23, 30, 00), DateTimeKind.Utc);

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.DateStart.GreaterThan(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().DateStart > filterValue && games.Last().DateStart > filterValue;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #10
0
        public void FilterByTeam2Test()
        {
            var client = GetClient();

            var filterValue = TeamAbbreviations.Edmonton;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Team2.GreaterThan(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = string.Compare(games.First().Team2.Abbreviation, filterValue) == 1 && string.Compare(games.Last().Team2.Abbreviation, filterValue) == 1;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #11
0
        public void FilterByAttendanceTest()
        {
            var client = GetClient();

            var filterValue = 27279;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Attendance.GreaterThan(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().Attendance > filterValue && games.Last().Attendance > filterValue;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #12
0
        public void FilterByWeekTest()
        {
            var client = GetClient();

            var filterValue = 5;

            var options = new GamesRequestOptions {
                Filters = new[] { GamesFilterFactory.Week.EqualTo(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().Week == filterValue && games.Last().Week == filterValue;

            Assert.AreEqual(expected, actual, client.LastRequestUrl);
        }
Пример #13
0
        public void FilterPlayByPlayTest()
        {
            var client = GetClient();

            var filterValue = 110;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.PlayByPlaySequence.GreaterThan(filterValue) }
            };

            var game = client.GetGame(2016, 2267, includePlayByPlay: true, options: options);

            var expected = 58;
            var actual   = game.PlayByPlay?.Count(p => p.PlaySequence > filterValue);

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #14
0
        public void FilterByTeam2Test()
        {
            var client = GetClient();

            var filterValue = TeamAbbreviations.Winnipeg;

            var options = new GamesRequestOptions {
                Filters = new[] { GamesFilterFactory.Team2.EqualTo(filterValue) }
            };

            var games = client.GetGames(options: options);

            var expected = true;
            var actual   = games.First().Team2.Abbreviation == filterValue && games.Last().Team2.Abbreviation == filterValue;

            Assert.AreEqual(expected, actual, client.LastRequestUrl);
        }
Пример #15
0
        public void FilterByTemperatureTest()
        {
            var client = GetClient();

            var temp1 = 21;
            var temp2 = 24;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Temperature.In(temp1, temp2) }
            };

            var games = client.GetGames(options: options);

            var expected = 2;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #16
0
        public void FilterByAttendanceTest()
        {
            var client = GetClient();

            var value1 = 27279;
            var value2 = 19452;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Attendance.In(value1, value2) }
            };

            var games = client.GetGames(options: options);

            var expected = 2;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #17
0
        public void FilterByTeam2Test()
        {
            var client = GetClient();

            var team1 = TeamAbbreviations.Saskatchewan;
            var team2 = TeamAbbreviations.Winnipeg;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Team2.In(team1, team2), FluentGamesFilterFactory.EventTypeId.EqualTo(EventTypeIds.Preseason) }
            };

            var games = client.GetGames(season: 2015, options: options);

            var expected = 2;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #18
0
        public void FilterByDateStartTest()
        {
            var client = GetClient();

            var date1 = new DateTime(2015, 06, 23);
            var date2 = new DateTime(2015, 06, 24);

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.DateStart.In(date1, date2) }
            };

            var games = client.GetGames(options: options);

            var expected = 2;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #19
0
        public void FilterBySeasonTest()
        {
            var client = GetClient();

            var season1 = 2014;
            var season2 = 2015;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.Season.In(season1, season2), FluentGamesFilterFactory.EventTypeId.EqualTo(EventTypeIds.GreyCup) }
            };

            var games = client.GetGames(options: options);

            var expected = 2;
            var actual   = games.Count();

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #20
0
        public void FilterPlayByPlayTest()
        {
            var client = GetClient();

            var expected1 = 10;
            var expected2 = 50;

            var options = new GamesRequestOptions {
                Filters = new[] { FluentGamesFilterFactory.PlayByPlaySequence.In(expected1, expected2) }
            };

            var game = client.GetGame(2016, 2267, includePlayByPlay: true, options: options);

            var play1 = game.PlayByPlay?.FirstOrDefault(p => p.PlaySequence == expected1);

            Assert.IsNotNull(play1, Endpoint.RequestClient.LastRequestUrl);

            var play2 = game.PlayByPlay?.FirstOrDefault(p => p.PlaySequence == expected2);

            Assert.IsNotNull(play2, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #21
0
        public void SortByWeekTest()
        {
            var client = GetClient();

            var descendingOptions = new GamesRequestOptions {
                Sorts = new[] { new GameSort(GameSortTypes.Week, SortOrder.Descending) }
            };
            var gamesDescending = client.GetGames(options: descendingOptions);

            var ascendingOptions = new GamesRequestOptions {
                Sorts = new[] { new GameSort(GameSortTypes.Week, SortOrder.Ascending) }
            };
            var gamesAscending = client.GetGames(options: ascendingOptions);

            var highest = gamesDescending.First().Week;
            var lowest  = gamesAscending.First().Week;

            var expected = true;
            var actual   = highest > lowest;

            Assert.AreEqual(expected, actual, Endpoint.RequestClient.LastRequestUrl);
        }
Пример #22
0
        public void FilterByTemperatureTest()
        {
            var client = GetClient();

            var filterValue = 21;

            var options = new GamesRequestOptions {
                Filters = new[] { GamesFilterFactory.Temperature.EqualTo(filterValue) }
            };

            var games     = client.GetGames(season: 2015, options: options);
            var firstGame = games.FirstOrDefault();
            var lastGame  = games.LastOrDefault();

            Assert.IsNotNull(firstGame, client.LastRequestUrl);
            Assert.IsNotNull(lastGame, client.LastRequestUrl);

            var expected = true;
            var actual   = games.First().Weather.Temperature == filterValue && games.Last().Weather.Temperature == filterValue;

            Assert.AreEqual(expected, actual, client.LastRequestUrl);
        }