public void MapCopiesDataFromPeopleToPlayer() { People people = _testHelpers.GeneratePeople(); Player player = _mapper.Map(people); AssertThatEachElementIsEqual(people, player); }
public void MapPlayerToPlayerViewModelWithGamesAndGamesOwned() { var player = new Player { Id = 2, FirstName = "First Name", LastName = "Last Name" }; var games = new List <SelectListItem> { new SelectListItem { Value = "1", Text = "Game 1" } }; var gamesOwned = new List <GameViewModel> { new GameViewModel { Id = 1, Name = "Game 1" } }; var mapper = new PlayerMapper(); var viewModel = mapper.Map(player, games, gamesOwned); Assert.Equal(player.Id, viewModel.Id); Assert.Equal(player.FirstName, viewModel.FirstName); Assert.Equal(player.LastName, viewModel.LastName); Assert.Equal("First Name Last Name", viewModel.FullName); Assert.Equal(1, viewModel.Games.Count()); Assert.Equal(1, viewModel.GamesOwned.Count()); }
public void MapDynamoItemToModel_Scenario_ReturnsPlayerFromItem() { var draftId = "AAA"; var name = "Tester"; var connectionId = "123abc"; var isConnected = false; var item = new Dictionary <string, AttributeValue> { { "DraftId", new AttributeValue { S = draftId } }, { "Name", new AttributeValue { S = name } }, { "ConnectionId", new AttributeValue { S = connectionId } }, { "IsConnected", new AttributeValue { BOOL = isConnected } } }; var _playerMapper = new PlayerMapper(); var result = _playerMapper.Map(item); Assert.Equal(draftId, result.DraftId); Assert.Equal(name, result.Name); Assert.Equal(connectionId, result.ConnectionId); Assert.Equal(isConnected, result.IsConnected); }
public void MapNewPlayerToPlayerViewModel() { var player = new Player(); var mapper = new PlayerMapper(); var viewModel = mapper.Map(player); Assert.NotNull(viewModel); }
public async Task <PlayerModel> CreatePlayer(CreatePlayerCommand command) { var rating = await ratingApiClient.GetDefaultPlayerRating(); CreatePlayerRequest createPlayerRequest = new CreatePlayerRequest(command.Name, rating.Rating, rating.Deviation, rating.Volatility); Player createdPlayer = await playersApiClient.CreatePlayer(createPlayerRequest); return(PlayerMapper.Map(createdPlayer)); }
public void MapNullToPlayerViewModelWithGamesAndEmptyGamesOwnedOnly() { var games = new List <SelectListItem> { new SelectListItem { Value = "1", Text = "Game 1" } }; var mapper = new PlayerMapper(); var viewModel = mapper.Map(null, games, new List <GameViewModel>()); Assert.NotNull(viewModel); Assert.Equal(1, viewModel.Games.Count()); }
List <PlayerDTO> IFMService.FindPlayers(int NumberOfPlayers) { List <Player> Players = new List <Player>(); foreach (Player P in _PlayerRepository.ListEntities()) { if (_PlayerRepository.ListEntities(obj => obj.ID == P.ID).Count() == NumberOfPlayers) { Players.Add(P); } } return(Players.Select(obj => PlayerMapper.Map(obj)).ToList()); }
public void PlayerMapper_Can_Map_PlayerDto_To_PlayerModel() { // Arrange var mapper = new PlayerMapper(); var playerDto = new PlayerDto(Guid.NewGuid(), "PlayerName"); // Act var playerModel = mapper.Map(playerDto); // Assert playerModel.Should().BeEquivalentTo(playerDto, properties => properties .Including(x => x.Id) .Including(x => x.Name)); }
public void MapPlayerViewModelToPlayer() { var viewModel = new PlayerViewModel { Id = 2, FirstName = "First Name", LastName = "Last Name" }; var mapper = new PlayerMapper(); var player = mapper.Map(viewModel); Assert.Equal(viewModel.Id, player.Id); Assert.Equal(viewModel.FirstName, player.FirstName); Assert.Equal(viewModel.LastName, player.LastName); }
public void MapExistingPlayerToPlayerViewModel() { var player = new Player { Id = 2, FirstName = "First Name", LastName = "Last Name" }; var mapper = new PlayerMapper(); var viewModel = mapper.Map(player); Assert.Equal(player.Id, viewModel.Id); Assert.Equal(player.FirstName, viewModel.FirstName); Assert.Equal(player.LastName, viewModel.LastName); Assert.Equal("First Name Last Name", viewModel.FullName); }
public void MapPlayerToPlayerViewModelWithGamesAndGamesOwnedOnly() { var player = new Player(); var games = new List <SelectListItem> { new SelectListItem { Value = "1", Text = "Game 1" } }; var gamesOwned = new List <GameViewModel> { new GameViewModel { Id = 1, Name = "Game 1" } }; var mapper = new PlayerMapper(); var viewModel = mapper.Map(player, games, gamesOwned); Assert.NotNull(viewModel); Assert.Equal(1, viewModel.Games.Count()); }
public void PlayerMapper_Can_Map_PlayerModel_To_PlayerDto() { // Arrange var mapper = new PlayerMapper(); var playerModel = new Player { Id = Guid.NewGuid(), Name = "PlayerName" }; // Act var playerDto = mapper.Map(playerModel); // Assert playerDto.Should().BeEquivalentTo(playerModel, properties => properties .Including(x => x.Id) .Including(x => x.Name)); }
private void addPlayers(IEnumerable <Model.Seven.Player> sevens, IEnumerable <Model.Steam.Player> steams) { var players = sevens.Join(steams, _7 => _7.SteamId, s => s.SteamId, (_7, s) => PlayerMapper.Map(s, _7)).Select(x => new PlayerViewModel(x)).ToList(); foreach (var player in players) { if (Players.Contains(player)) { Players.Remove(player); } Players.Add(player); } }
public List <PlayerDTO> List() { return(this.ListEntities().Select(obj => PlayerMapper.Map(obj)).ToList()); }
public List <PlayerDTO> FindByFirstName(string FirstName) { return(this.FindByFirstNameEntity(FirstName).Select(obj => PlayerMapper.Map(obj)).ToList()); }
public async Task <PlayerModel> GetPlayerById(string id) { Player player = await playersApiClient.GetPlayer(id); return(PlayerMapper.Map(player)); }
public async Task <IReadOnlyCollection <PlayerModel> > GetAllPlayers() { var players = await playersApiClient.GetAllPlayers(); return(PlayerMapper.Map(players)); }
public List <PlayerDTO> FindByAge(int Age) { return(this.FindByAgeEntity(Age).Select(obj => PlayerMapper.Map(obj)).ToList()); }
public PlayerDTO Get(int ID) { return(PlayerMapper.Map(this.GetEntity(ID))); }