public void CategoryRepoMethods() { DapperCategoryRepository repoCategory = new DapperCategoryRepository(); Category c = new Category { CategoryAge = ageCategoryType.junior, CategoryValue = 180 }; repoCategory.Create(c); Assert.IsNotNull(c.CategoryId); c.CategoryValue = 185; c.CategoryAge = ageCategoryType.junior; repoCategory.Update(c); Assert.AreEqual(185, c.CategoryValue); repoCategory.get(c.CategoryId); Assert.AreEqual(185, c.CategoryValue); int Id = c.CategoryId; Category c1 = new Category { CategoryAge = ageCategoryType.junior, CategoryValue = 185 }; repoCategory.Create(c1); Assert.AreEqual(0, c1.CategoryId); IEnumerable <Category> Categoryes = repoCategory.getAll(); Assert.AreNotEqual(0, Categoryes.Count()); Assert.AreEqual(ageCategoryType.junior, Categoryes.Where(Category => Category.CategoryAge == ageCategoryType.junior && Category.CategoryValue == 185).FirstOrDefault().CategoryAge); repoCategory.Delete(Id); }
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); }