public void CanGetGameDtoFromGameInstance() { Game gameToConvert = GameTypeMapperUnitTest.CreateGameInstance(); GameTypeMapper gameTypeMapper = new GameTypeMapper(); ////Set up AutoMapper mappings. AutoMapperConfig.Configure(); ////Check that AutoMapper configuration is valid. //Mapper.AssertConfigurationIsValid(); string gameUri = "api/games/12"; GameDto gameDto = gameTypeMapper.GetEntityDto(gameToConvert, gameUri); Assert.IsNotNull(gameDto); Assert.AreEqual<int>(gameToConvert.Id, gameDto.Id); Assert.AreEqual<string>(gameToConvert.HomeTeam.Name, gameDto.HomeTeamName); Assert.AreEqual<string>(gameToConvert.VisitingTeam.Name, gameDto.VisitingTeamName); Assert.AreEqual<string>(gameToConvert.FavoriteTeam.Name, gameDto.FavoriteTeamName); Assert.AreEqual(gameToConvert.StartDateTime, gameDto.StartDateTime); Assert.AreEqual<float>(gameToConvert.Line, gameDto.Line); Assert.AreEqual<int>(4, gameDto.HypermediaLinks.Count); Assert.AreEqual<string>(gameUri, gameDto.HypermediaLinks[0].Href); Assert.AreEqual<string>(gameUri + "/hometeam", gameDto.HypermediaLinks[1].Href); Assert.AreEqual<string>(gameUri + "/visitingteam", gameDto.HypermediaLinks[2].Href); Assert.AreEqual<string>(gameUri + "/favoriteteam", gameDto.HypermediaLinks[3].Href); }
public void CanGetGameSnapshotFromGameDtoInstance() { //GameDto gameDtoToConvert = GameTypeMapperUnitTest.CreateGameDtoInstance(); GameBaseRequestModel gameRequest = GameTypeMapperUnitTest.CreateGameRequestModel(); GameTypeMapper gameTypeMapper = new GameTypeMapper(); ////Set up AutoMapper mappings. AutoMapperConfig.Configure(); GameSnapshot game = gameTypeMapper.GetGameSnapshot(gameRequest); Assert.IsNotNull(game); Assert.AreEqual<int>(gameRequest.HomeTeamId.Value, game.HomeTeamId); Assert.AreEqual<int>(gameRequest.VisitingTeamId.Value, game.VisitingTeamId); Assert.AreEqual<int>(gameRequest.FavoriteTeamId.Value, game.FavoriteTeamId); Assert.AreEqual<DateTime>(gameRequest.StartDateTime.Value, game.StartDateTime); Assert.AreEqual<int>(gameRequest.WeekNumber.Value, game.WeekNumber); Assert.AreEqual<float>(gameRequest.Line.Value, game.Line); Assert.AreEqual<float>(gameRequest.OverUnder.Value, game.OverUnder); }