public async Task UpdateNotExistingSeason() { var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var mockChampionshipRepo = new Mock <IRepository <Championship> >(); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var updatedViewModel = new SeasonViewModel { Id = 1, Name = "2015/16", ChampionshipId = 1 }; await Assert.ThrowsAsync <Exception>(() => seasonService.UpdateAsync(updatedViewModel)); }
public void SetUp() { _unitOfWork = new Mock <IUnitOfWork>(); _seasonRepository = new Mock <ISeasonRepository>(); _seasonService = new SeasonService(_unitOfWork.Object, _seasonRepository.Object); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasyDataClient(string primarySubscriptionKey, string secondarySubscriptionKey) { Uri statApiBaseUrl = NFLConfig.StateApiBaseUrl; Uri scoreApiBaseUrl = NFLConfig.ScoreApiBaseUrl; Uri ProjectionApiBaseUrl = NFLConfig.ProjectionApiBaseUrl; DailyFantasyService = new DailyFantasyService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonService = new SeasonService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); NewsService = new NewsService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameStatService = new PlayerGameStatService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerSeasonStatService = new PlayerSeasonStatService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamDefenseService = new TeamDefenseService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameService = new GameService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); InjuryService = new InjuryService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StadiumService = new StadiumService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamService = new TeamService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScoreService = new BoxScoreService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerService = new PlayerService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScheduleService = new ScheduleService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TimeFrameService = new TimeFrameService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamSeasonService = new TeamSeasonService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamGameService = new TeamGameService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScoresService = new ScoresService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScoresService = new ScoresService(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); DfsSlateService = new DfsSlateService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); PlayerGameProjectionsService = new PlayerGameProjectionService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); PlayerSeasonProjectionService = new PlayerSeasonProjectionService(ProjectionApiBaseUrl.AbsoluteUri, NFLConfig.ProjectionPrimarySubscriptionKey, NFLConfig.ProjectionSecondarySubscriptionKey); }
public PriceController(SalesOptimalizationService optimizer, IPricedProductRepository pricedProductRepository, IMapper mapper, ILogger <PriceController> logger, SeasonService seasonService) { _optimizer = optimizer; _pricedProductRepository = pricedProductRepository; _mapper = mapper; _logger = logger; _seasonService = seasonService; }
public void SetUp() { dbContext = DbContextUtility.CreateMockDb(); scheduler = Substitute.For <IScheduleFactory>(); pointCalculator = Substitute.For <ISeasonPointCalculator>(); var tieBreakerFactory = Substitute.For <ITieBreakerFactory>(); tieBreaker = Substitute.For <ITieBreaker>(); tieBreakerFactory.Create().Returns(tieBreaker); testObj = new SeasonService(dbContext, scheduler, pointCalculator, tieBreakerFactory); }
public async Task SaveAndUpdateSeasonWithNameOfAnotherdExistingSeason() { var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var id = 1; var mockChampionshipRepo = new Mock <IRepository <Championship> >(); mockChampionshipRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => championshipsList.FirstOrDefault(c => c.Id == id)); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); mockSeasonRepo.Setup(r => r.AddAsync(It.IsAny <Season>())).Callback <Season>(season => seasonsList.Add(new Season { Id = id++, Name = season.Name, Championship = season.Championship })); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var firstSeasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1 }; var secondSeasonViewModel = new SeasonViewModel { Name = "2019/20", ChampionshipId = 1 }; await seasonService.CreateAsync(firstSeasonViewModel); await seasonService.CreateAsync(secondSeasonViewModel); var secondUpdatedViewModel = new SeasonViewModel { Id = 2, Name = "2020/21", ChampionshipId = 1 }; await Assert.ThrowsAsync <Exception>(() => seasonService.UpdateAsync(secondUpdatedViewModel)); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasyDataClient(Uri apiBaseUrl, string primarySubscriptionKey, string secondarySubscriptionKey) { DailyFantasyService = new DailyFantasyService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonService = new SeasonService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); NewsService = new NewsService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameStatService = new PlayerGameStatService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerSeasonStatService = new PlayerSeasonStatService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamDefenseService = new TeamDefenseService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameService = new GameService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); InjuryService = new InjuryService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StadiumService = new StadiumService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamService = new TeamService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScoreService = new BoxScoreService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerService = new PlayerService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScheduleService = new ScheduleService(apiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); }
public async Task SaveAndUpdateSeason() { var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var mockChampionshipRepo = new Mock <IRepository <Championship> >(); mockChampionshipRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => championshipsList.FirstOrDefault(c => c.Id == id)); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); mockSeasonRepo.Setup(r => r.AddAsync(It.IsAny <Season>())).Callback <Season>(season => seasonsList.Add(new Season { Id = 1, Name = season.Name, Championship = season.Championship })); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var seasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1 }; await seasonService.CreateAsync(seasonViewModel); var updatedViewModel = new SeasonViewModel { Id = 1, Name = "2020/21", ChampionshipId = 1 }; await seasonService.UpdateAsync(updatedViewModel); var savedSeason = seasonService.Get(1); Assert.Equal(1, savedSeason.Id); Assert.Equal("2020/21", savedSeason.Name); }
public UserControl_Seasons(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); ComboBoxStartYear.Dispatcher.BeginInvoke((Action)(() => ComboBoxStartYear.IsEnabled = false)); ComboBoxEndYear.Dispatcher.BeginInvoke((Action)(() => ComboBoxEndYear.IsEnabled = false)); ButtonSaveSeason.Dispatcher.BeginInvoke((Action)(() => ButtonSaveSeason.IsEnabled = false)); _mainContent = mainContent; seasonService = new SeasonService(); LoadFormData(); }).Start(); }
public UserControl_Competitions(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); _mainContent = mainContent; ComboBoxSeason.Dispatcher.BeginInvoke((Action)(() => ComboBoxSeason.IsEnabled = false)); competitionService = new CompetitionService(); seasonService = new SeasonService(); LoadFormCompetitions(); }).Start(); }
public async Task SaveAndLoadSeason() { var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var mockChampionshipRepo = new Mock <IRepository <Championship> >(); mockChampionshipRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => championshipsList.FirstOrDefault(c => c.Id == id)); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); mockSeasonRepo.Setup(r => r.AddAsync(It.IsAny <Season>())).Callback <Season>(season => seasonsList.Add(season)); mockSeasonRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => seasonsList.FirstOrDefault(c => c.Id == id)); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var seasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1, ChampionshipName = "Premier League", Description = "Premier League, Season 2020/21" }; await seasonService.CreateAsync(seasonViewModel); var savedSeason = seasonService.Get(10, false); var lastSavedSeason = seasonService.GetAll().LastOrDefault(); Assert.Null(savedSeason); Assert.Equal("2020/21", lastSavedSeason.Name); Assert.Equal("Premier League, Season 2020/21", seasonViewModel.Description); Assert.Equal("Premier League", seasonViewModel.ChampionshipName); Assert.NotNull(lastSavedSeason.Championship); }
public UserControl_Begin(UserControl_MainContent mainContent) { InitializeComponent(); new Thread(() => { UtilsNotification.StartLoadingAnimation(); _mainContent = mainContent; seasonService = new SeasonService(); competitionService = new CompetitionService(); teamService = new TeamService(); matchService = new MatchService(); Thread.Sleep(1000); TextBoxNSeasons.Dispatcher.BeginInvoke((Action)(() => TextBoxNSeasons.Text = seasonService.GetSeasonsNumber().ToString())); TextBoxNCompetitions.Dispatcher.BeginInvoke((Action)(() => TextBoxNCompetitions.Text = competitionService.GetCompetitionsNumber().ToString())); TextBoxNTeams.Dispatcher.BeginInvoke((Action)(() => TextBoxNTeams.Text = teamService.GetTeamsNumber().ToString())); TextBoxNMatches.Dispatcher.BeginInvoke((Action)(() => TextBoxNMatches.Text = matchService.GetMatchesNumber().ToString())); UtilsNotification.StopLoadingAnimation(); }).Start(); }
public async Task SaveTwoSeasonsWithSameNames() { var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var mockChampionshipRepo = new Mock <IRepository <Championship> >(); mockChampionshipRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => championshipsList.FirstOrDefault(c => c.Id == id)); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); mockSeasonRepo.Setup(r => r.AddAsync(It.IsAny <Season>())).Callback <Season>(season => seasonsList.Add(season)); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var firstSeasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1 }; var secondSeasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1 }; await seasonService.CreateAsync(firstSeasonViewModel); await Assert.ThrowsAsync <Exception>(() => seasonService.CreateAsync(secondSeasonViewModel)); }
public void Delete(int id) { SeasonService.deletePlayer(id); }
public SeasonsController(SeasonService seasonService) { _seasonService = seasonService; }
public SeasonController(SeasonService _seasonService) { this._seasonService = _seasonService; }
public Season[] GetAll() { return(SeasonService.getAllSeasons()); }
public List <PlayerBetSummary> GetPlayerStandingsForSeason(int seasonID) { return(SeasonService.GetPlayerStandingsForSeason(seasonID)); }
public List <PlayerBetSummary> GetPlayerBetSummariesForEvents(int seasonID) { return(SeasonService.GetPlayerBetSummariesForEvents(seasonID)); }
public void Delete(int id) { SeasonService.deleteSeason(id); }
public PlayerBetSummary GetCurrentPlayerStats(PlayerNameAndSeason dto) { return(SeasonService.GetCurrentPlayerStats(dto.SeasonID, dto.PlayerName)); }
public async Task GetAllSeasonsAsKeyValuePairs() { var countriesList = new List <Country> { new Country { Id = 1, Name = "England" } }; var championshipsList = new List <Championship> { new Championship { Id = 1, Name = "Premier League" } }; var seasonsList = new List <Season>(); var mockCountryRepo = new Mock <IRepository <Country> >(); mockCountryRepo.Setup(r => r.All()).Returns(countriesList.AsQueryable()); var mockChampionshipRepo = new Mock <IRepository <Championship> >(); mockChampionshipRepo.Setup(r => r.All()).Returns(championshipsList.AsQueryable()); mockChampionshipRepo.Setup(r => r.Get(It.IsAny <int>())).Returns <int>(id => championshipsList.FirstOrDefault(c => c.Id == id)); var mockSeasonRepo = new Mock <IRepository <Season> >(); mockSeasonRepo.Setup(r => r.All()).Returns(seasonsList.AsQueryable()); mockSeasonRepo.Setup(r => r.AddAsync(It.IsAny <Season>())).Callback <Season>(season => seasonsList.Add(new Season { Id = 1, Name = season.Name, Championship = season.Championship })); var seasonService = new SeasonService(mockSeasonRepo.Object, mockChampionshipRepo.Object); var firstSeasonViewModel = new SeasonViewModel { Name = "2020/21", ChampionshipId = 1, ChampionshipsItems = new ChampionshipService( mockChampionshipRepo.Object, mockCountryRepo.Object) .GetAllAsKeyValuePairs() }; var secondSeasonViewModel = new SeasonViewModel { Name = "2021/22", ChampionshipId = 1 }; await seasonService.CreateAsync(firstSeasonViewModel); await seasonService.CreateAsync(secondSeasonViewModel); var keyValuePairs = seasonService.GetAllAsKeyValuePairs().ToList(); Assert.True(keyValuePairs.Count == 2); Assert.True(firstSeasonViewModel.ChampionshipsItems.Count() == 1); }
public Season GetById(int id) { return(SeasonService.getSeasonByID(id)); }
public int GetSeasonIdByName(string name) { return(SeasonService.getSeasonIdByName(name)); }
public SeasonWithPlayers GetSeasonWithPlayers(int id) { return(SeasonService.getSeasonWithPlayers(id)); }
public FullSeason GetFullSeason(int id) { return(SeasonService.getFullSeason(id)); }
public void CreateOrUpdate([FromBody] Player p) { SeasonService.createOrUpdatePlayer(p); }
public String ResetSeason(int seasonID) { SeasonService.ResetSeason(seasonID); return("Success"); }
public RankedDataController(ILogger <RankedDataController> logger, RankedService rankedService, SeasonService seasonService) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rankedService = rankedService ?? throw new ArgumentNullException(nameof(rankedService)); _seasonService = seasonService ?? throw new ArgumentNullException(nameof(seasonService)); }
public void Edit([FromBody] EditSeasonDto s) { SeasonService.createSeasonWithPlayers(s); }