public void PlayerRepoMethods() { DapperPlayerRepository repoPlayer = new DapperPlayerRepository(); DapperClubRepository repoClub = new DapperClubRepository(); DapperCityRepository repoCity = new DapperCityRepository(); City c = new City { CityName = "testNew York" }; repoCity.Create(c); int cId = c.CityId; Club cl = new Club { ClubName = "testNew York Club", City = c }; repoClub.Create(cl); var clId = cl.ClubId; Player pl = new Player { PlayerFio = "Vasya", PlayerBornDate = DateTime.Now, PlayerWeight = 100, PlayerGender = genderType.male, PlayerHeight = 160, Club = cl }; repoPlayer.Create(pl); Assert.IsNotNull(pl.PlayerId); pl.PlayerFio = "Vasya2"; repoPlayer.Update(pl); Assert.AreEqual("Vasya2", pl.PlayerFio); repoPlayer.get(pl.PlayerId); Assert.AreEqual("Vasya2", pl.PlayerFio); int Id = pl.PlayerId; IEnumerable <Player> Playeres = repoPlayer.getAll(); Assert.AreNotEqual(0, Playeres.Count()); Assert.AreEqual("Vasya2", Playeres.Where(Player => Player.PlayerFio == "Vasya2").FirstOrDefault().PlayerFio); repoPlayer.Delete(Id); repoClub.Delete(clId); repoCity.Delete(cId); }
public void StandingsRawRepoMethods() { DapperPlayerRepository repoPlayer = new DapperPlayerRepository(); DapperClubRepository repoClub = new DapperClubRepository(); DapperCityRepository repoCity = new DapperCityRepository(); City city = new City { CityName = "testNew York" }; repoCity.Create(city); int cId = city.CityId; Club cl = new Club { ClubName = "testNew York Club", City = city }; repoClub.Create(cl); var clId = cl.ClubId; Player p = new Player { PlayerFio = "Vasya", PlayerBornDate = DateTime.Now, PlayerWeight = 100, PlayerGender = genderType.male, PlayerHeight = 160, Club = cl }; repoPlayer.Create(p); int pId = p.PlayerId; DapperCategoryRepository repoCategory = new DapperCategoryRepository(); Category cat = new Category { CategoryAge = ageCategoryType.junior, CategoryValue = 180 }; repoCategory.Create(cat); int catId = cat.CategoryId; DapperStandingsRawRepository repoStandingsRaw = new DapperStandingsRawRepository(); StandingsRaw c = new StandingsRaw { Player = p, Category = cat, StandingsRawLevel = 1, StandingsRawPairNum = 1, StandingsRawGender = genderType.male }; repoStandingsRaw.Create(c); Assert.IsNotNull(c.StandingsRawId); int Id = c.StandingsRawId; repoStandingsRaw.Delete(Id); repoPlayer.Delete(pId); repoClub.Delete(clId); repoCity.Delete(cId); repoCategory.Delete(catId); }