public void InitTest() { context = new CSBC.Core.Data.CSBCDbContext(); //context.CSDBConnectionString = ConfigurationManager.ConnectionStrings["CSBCContext"]; var tester = new CSBCDbInitializer(); tester.InitSeasons(context); }
public void InitTest() { using (var context = new CSBC.Core.Data.CSBCDbContext()) { var tester = new CSBCDbInitializer(); tester.InitDirectorTest(); } }
public void GetNextDraftIdTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var player = new Player { DivisionID = 25, PeopleID = 2, CompanyID = 1, CoachID = 2, SeasonID = 2 }; var rep = new PlayerRepository(context); var count = rep.GetNextDraftId(1, 2, 25); Assert.IsTrue(!String.IsNullOrEmpty(count)); }
public void GetDivisionRecordsTest() { context = new CSBCDbContext(); var house = new Division(); var rep = new DivisionRepository(context); var seasonRep = new SeasonRepository(context); var season = seasonRep.GetCurrentSeason(1); var divisions = rep.GetDivisions(season.SeasonID); Assert.IsTrue(divisions.Any<Division>()); }
public void GetPlayerDivisionTest() { context = new CSBCDbContext(); var repPeople = new PlayerRepository(context); var player = context.Players.FirstOrDefault(); //var person = repPeople.GetById(2); var repSeason = new SeasonRepository(context); var season = repSeason.GetCurrentSeason(1); var repDivision = new DivisionRepository(context); var dt = repDivision.GetPlayerDivision(1, season.SeasonID, player.PeopleID); Assert.IsTrue(dt != 0); }
public void InitDivisionTest() { context = new CSBCDbContext(); var repDivision = new DivisionRepository(context); var division = new Division { Div_Desc = "Unit Test", CompanyID = 1, Gender = "M", MinDate = DateTime.Now, MaxDate = DateTime.Now.AddDays(60) }; var divisionret = repDivision.Insert(division); Assert.IsTrue(divisionret != null); }
// The id parameter name should match the DataKeyNames value set on the control public void grdColors_UpdateItem(int id) { using (var context = new CSBC.Core.Data.CSBCDbContext()) { var rep = new ColorRepository(context); Color item = null; item = rep.GetById(id); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", id)); return; } TryUpdateModel(item); if (ModelState.IsValid) { context.SaveChanges(); } } }
// The id parameter name should match the DataKeyNames value set on the control public void grdColors_DeleteItem(int id) { using (var context = new CSBC.Core.Data.CSBCDbContext()) { var rep = new ColorRepository(context); var item = rep.GetById(id); if (item == null) { // The item wasn't found ModelState.AddModelError("", String.Format("Item with id {0} was not found", id)); return; } if (HasColorBeenUsed(id)) { MasterVM.MsgBox(this, "Can't delete color that has been used!"); } else { rep.Delete(item); } } }
public void InitTest() { context = new CSBC.Core.Data.CSBCDbContext(); var tester = new CSBCDbInitializer(); tester.InitUser(context); }
public void GetPlayersTest() { var testinit = new CSBCDbInitializer(); var context = new CSBC.Core.Data.CSBCDbContext(); var house = new Player(); var rep = new PlayerRepository(context); var players = rep.GetSeasonPlayers(testinit.CurrentSeason.SeasonID); int no = players.Count<SeasonPlayer>(); Assert.IsTrue(players.Count<SeasonPlayer>() > 1); var player = players.First(); Assert.IsTrue(player.PeopleID > 0); }
public void GetTeamPlayersTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var rep = new PlayerRepository(context); var repTeam = new TeamRepository(context); //var seasonId = repSeason.GetCurrentSeason(1).SeasonID; var players = rep.GetTeamPlayers(5954); //test value Assert.IsTrue(players.Count<SeasonPlayer>() > 0); }
public void InsertPlayerTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var player = new Player { DivisionID = 25, PeopleID = 2, CompanyID = 1, CoachID = 2, SeasonID = 2 }; var rep = new PlayerRepository(context); var id = rep.Insert(player); Assert.IsTrue(context.Players.Count<Player>(p=>p.CompanyID==1 && p.SeasonID ==2 && p.DivisionID == 25) > 0); Assert.IsTrue(context.Players.Find( id.PlayerID ) != null); }
public void GetSponsorPlayersTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var rep = new PlayerRepository(context); var players = rep.GetSponsorPlayers(7478, 23893); //test value Assert.IsTrue(players.Any<SeasonPlayer>() ); }
public void GetSeasonPlayersTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var rep = new PlayerRepository(context); var repSeason = new SeasonRepository(context); var seasonId = repSeason.GetCurrentSeason(1).SeasonID; var players = rep.GetPlayers(seasonId); Assert.IsTrue(players.Count<SeasonPlayer>() > 0); }
public void LoadDivisionTest() { context = new CSBCDbContext(); var repDivision = new DivisionRepository(context); var divisions = repDivision.LoadDivisions(2); Assert.IsTrue(divisions.Count<vw_Divisions>() != 0); }
public void InitTest() { var context = new CSBC.Core.Data.CSBCDbContext(); var tester = new CSBCDbInitializer(); tester.InitDivision(context); }
public void TestCleanup() { var context = new CSBC.Core.Data.CSBCDbContext(); var tester = new TestUtils(context); tester.CleanupDb(); }