public async Task GetPlayersTest() { var movies = new List <Player> { new Player() { PlayerName = "test messi1" }, new Player() { PlayerName = "test messi2" } }; var fakeRepositoryMock = new Mock <IPlayerRepository>(); fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(movies); var playerService = new PlayerServices(fakeRepositoryMock.Object); var resultPlayers = await playerService.GetPlayers(); Assert.Collection(resultPlayers, player => { Assert.Equal("test messi1", player.PlayerName); }, player => { Assert.Equal("test messi2", player.PlayerName); }); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasySoccerClient(string primarySubscriptionKey, string secondarySubscriptionKey) { Uri statApiBaseUrl = SoccerConfig.StateApiBaseUrl; Uri scoreApiBaseUrl = SoccerConfig.ScoreApiBaseUrl; Uri ProjectionApiBaseUrl = SoccerConfig.ProjectionApiBaseUrl; AreaServices = new AreaServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); CompetitionServices = new CompetitionServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonServices = new SeasonServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScoreServices = new BoxScoreService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameServices = new GameServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); MembershipServices = new MembershipServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameStatServices = new PlayerGameStatServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerSeasonStatServices = new PlayerSeasonStatServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerServices = new PlayerServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ScheduleServices = new ScheduleServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonServices = new SeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StandingServices = new StandingServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamGameServices = new TeamGameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamSeasonService = new TeamSeasonService(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamServices = new TeamServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); VenueServices = new VenueServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, SoccerConfig.ProjectionPrimarySubscriptionKey, SoccerConfig.ProjectionSecondarySubscriptionKey); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasyNBAClient(string primarySubscriptionKey, string secondarySubscriptionKey) { Uri statApiBaseUrl = NBAConfig.StateApiBaseUrl; Uri scoreApiBaseUrl = NBAConfig.ScoreApiBaseUrl; Uri PbpApiBaseUrl = NBAConfig.PbpApiBaseUrl; Uri ProjectionApiBaseUrl = NBAConfig.ProjectionApiBaseUrl; CommonServices = new CommonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonServices = new SeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameServices = new GameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); NewsServices = new NewsServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StadiumsServices = new StadiumsServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StandingsServices = new StandingsServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); OpponentSeasonServices = new OpponentSeasonServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamServices = new TeamServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScoreServices = new BoxScoreServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); //DfsSlateServices = new DfsSlateServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerServices = new PlayerServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameServices = new PlayerGameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamSeasonServices = new TeamSeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); BoxScorePbpServices = new BoxScorePbpServices(PbpApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerSeasonServices = new PlayerSeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); DfsSlateServices = new DfsSlateServices(ProjectionApiBaseUrl.AbsoluteUri, NBAConfig.ProjectionPrimarySubscriptionKey, NBAConfig.ProjectionSecondarySubscriptionKey); ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, NBAConfig.ProjectionPrimarySubscriptionKey, NBAConfig.ProjectionSecondarySubscriptionKey); }
// GET: Roster public ActionResult Index() { // get all players var players = new PlayerServices().GetAllPlayers(); // pass them to the view return(View(players)); }
public override void ChangeDirection(Direction direction) { if (direction == PlayerServices.ReversedDirection(Owner.Direction)) { return; } base.ChangeDirection(direction); }
public async Task DeleteTest() { var fakeRepository = Mock.Of <IPlayerRepository>(); var playerService = new PlayerServices(fakeRepository); var player = new Player() { PlayerId = 2 }; await playerService.Delete(player); }
public async Task EditTest() { var fakeRepository = Mock.Of <IPlayerRepository>(); var playerService = new PlayerServices(fakeRepository); var player = new Player() { PlayerId = 3, PlayerName = "Ron", Deffence = 48, Offence = 95, TeamId = 1 }; await playerService.Edit(player); }
private static async Task AddTest() { var fakeRepository = Mock.Of <IPlayerRepository>(); var playerService = new PlayerServices(fakeRepository); var player = new Player() { PlayerId = 3, PlayerName = "RonaldoTest", Deffence = 48, Offence = 95, TeamId = 1 }; await playerService.AddAndSave(player); }
private async Task ExecuteAsync() { var sqliteDapper = new SqliteDapper(); using var dbConnection = sqliteDapper.Facyory(); var aPlayerServices = new PlayerServices(dbConnection); await aPlayerServices.CreatePlayer(sqliteDapper.DbPath); await aPlayerServices.AddPlayer(); await aPlayerServices.GetPlayersAsync(); }
public void PlayerExistsTest() { int PlayerId = 1; var fakeRepositoryMock = new Mock <IPlayerRepository>(); fakeRepositoryMock.Setup(x => x.PlayerExists(PlayerId)).Returns(true); var PlayerService = new PlayerServices(fakeRepositoryMock.Object); var isExist = PlayerService.PlayerExists(PlayerId); Assert.True(isExist); }
public void AddTerritoryTest() { //set up BoardField[,] fields = BoardTest.CreateTestMap().Board; var tailFields = new BoardField[] { fields[0, 2], fields[0, 1], fields[0, 0], fields[1, 0], fields[2, 0], fields[2, 1], fields[2, 2], }; var expectedClaimedFields = new BoardField[] { fields[0, 2], fields[0, 1], fields[0, 0], fields[1, 2], fields[1, 1], fields[1, 0], fields[2, 2], fields[2, 1], fields[2, 0] }; var expectedNotClaimedFields = new BoardField[] { fields[3, 2], fields[3, 1], fields[3, 0] }; var player = new PlayerModel(new Color(), fields[1, 2]); fields[1, 2].Owner = player; player.Tail.Positions.AddRange(tailFields); //test PlayerServices.AddTerritory(player); foreach (BoardField field in expectedClaimedFields) { Assert.IsTrue(field.Owner == player); } foreach (BoardField field in expectedNotClaimedFields) { Assert.IsTrue(field.Owner == MissingPlayer.Instance); } }
public override void OnUpdate() { if (Owner.OnOwnTerritory) { PlayerServices.AddTerritory(Owner.Player); Owner.DeleteTail(); Owner.InvokeOnTerritoryAdded(); Owner.MovingState = new DefensiveState(base.Owner); } else { Owner.SpawnTail(); } base.OnUpdate(); }
public async Task GetPlayerTest() { int Playerid = 1; var Player = new Player() { PlayerId = Playerid }; var fakeRepositoryMock = new Mock <IPlayerRepository>(); fakeRepositoryMock.Setup(x => x.GetPlayer(Playerid)).ReturnsAsync(Player); var PlayerService = new PlayerServices(fakeRepositoryMock.Object); var resultPlayer = await PlayerService.GetPlayer(Playerid); Assert.Equal(Playerid, resultPlayer.PlayerId); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public FantasyNHLClient(string primarySubscriptionKey, string secondarySubscriptionKey) { Uri statApiBaseUrl = NHLConfig.StateApiBaseUrl; Uri scoreApiBaseUrl = NHLConfig.ScoreApiBaseUrl; Uri ProjectionApiBaseUrl = NHLConfig.ProjectionApiBaseUrl; TeamServices = new TeamServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StadiumServices = new StadiumServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); GameServices = new GameServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerServices = new PlayerServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, NHLConfig.ProjectionPrimarySubscriptionKey, NHLConfig.ProjectionSecondarySubscriptionKey); BoxScoreServices = new BoxScoreServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); SeasonService = new SeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); DFSSlatesService = new DFSSlatesServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); StandingService = new StandingServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); PlayerGameService = new PlayerGameServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); TeamSeasonService = new TeamSeasonServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); NewsService = new NewsServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey, secondarySubscriptionKey); }
/// <summary> /// /// </summary> /// <param name="apiBaseUrl"></param> /// <param name="primarySubscriptionKey"></param> /// <param name="secondarySubscriptionKey"></param> public SportDataCSGOClient(string primarySubscriptionKey, string ProjectionPrimarySubscriptionKey) { Uri scoreApiBaseUrl = CSGOConfig.ScoreApiBaseUrl; Uri statApiBaseUrl = CSGOConfig.StateApiBaseUrl; Uri ProjectionApiBaseUrl = CSGOConfig.ProjectionApiBaseUrl; AreasServices = new AreaServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); CompetitionServices = new CompetitionServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); GameServices = new GameServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); MembershipServices = new MembershipServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); PlayerServices = new PlayerServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); SeasonServices = new SeasonServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ScheduleServices = new ScheduleServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); TeamServices = new TeamServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); VenueServices = new VenueServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); BoxScoreServices = new BoxScoreServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, ProjectionPrimarySubscriptionKey); }
public TeamsController() { teamServices = new TeamServices(); continentServices = new ContinentServices(); playerServices = new PlayerServices(); }
public PlayerController(PlayerServices services) { _services = services; }
public PlayerController(IConfiguration configuration, MongoClient mongoClient) { _services = new PlayerServices(configuration, mongoClient); }
public PlayersController() { playerServices = new PlayerServices(); teamServices = new TeamServices(); positionServices = new PositionServices(); }