public void TestEditTeamPass() { //Arrange _TestTeam.Name = "Hans' Helte"; //Act _TeamController.EditTeam(_TestTeam); Team tempTeam = _TeamController.GetTeam(_TestTeam.Id); //Assert Assert.AreEqual(_TestTeam.Name, tempTeam.Name); }
public void TestInitialize() { _TeamController = new TeamController(); _PlayerController = new PlayerController(); _TestTeam = new Team { Name = "TeamTest" }; _TestTeam2 = _TestTeam; _TestTeamFail = new Team(); _TeamController.CreateTeam(_TestTeam); _TestPlayer1 = new Player { NickName = "JohnnyBoi", Age = "87", Role = "Kaffehenter", TeamId = _TestTeam.Id }; _TestPlayer2 = new Player { NickName = "Zunny", Age = "109", Role = "AWP", TeamId = _TestTeam.Id }; _TestPlayer3 = new Player { NickName = "SvendBent", Age = "7", Role = "Rifle", TeamId = _TestTeam.Id }; _TestPlayer4 = new Player { NickName = "SkæveKaj", Age = "44", Role = "IGL/Rifler", TeamId = _TestTeam.Id }; _TestPlayer5 = new Player { NickName = "D0rteDeagle", Age = "42", Role = "Rifle", TeamId = _TestTeam.Id }; _PlayerController.CreatePlayer(_TestPlayer1); _TestTeam.Players.Add(_TestPlayer1); _PlayerController.CreatePlayer(_TestPlayer2); _TestTeam.Players.Add(_TestPlayer2); _PlayerController.CreatePlayer(_TestPlayer3); _TestTeam.Players.Add(_TestPlayer3); _PlayerController.CreatePlayer(_TestPlayer4); _TestTeam.Players.Add(_TestPlayer4); _PlayerController.CreatePlayer(_TestPlayer5); _TestTeam.Players.Add(_TestPlayer5); _TeamController.EditTeam(_TestTeam); }
public void TestInit() { int testTeam1Id = -1; int testTeam2Id = -1; int testMapId = -1; int testEventId = -1; //Instantiate controller UserController = new UserController(); TeamController = new TeamController(); PlayerController = new PlayerController(); MatchController = new MatchController(); EventController = new EventController(); //Build test objects: //Account TestUserAccount = new Account { Balance = 1000.00M }; //User TestUser = new User { Account = TestUserAccount, FirstName = "UserTestUser", LastName = "UserTestUser", UserName = "******", Email = "UserTestUser", PhoneNumber = "12345678" }; //Players TestPlayer1 = new Player { NickName = "TestPlayer1", Age = "99", Role = "Tester" }; TestPlayer2 = new Player { NickName = "TestPlayer2", Age = "99", Role = "Tester" }; TestPlayer3 = new Player { NickName = "TestPlayer3", Age = "99", Role = "Tester" }; TestPlayer4 = new Player { NickName = "TestPlayer4", Age = "99", Role = "Tester" }; TestPlayer5 = new Player { NickName = "TestPlayer5", Age = "99", Role = "Tester" }; TestPlayer6 = new Player { NickName = "TestPlayer6", Age = "99", Role = "Tester" }; TestPlayer7 = new Player { NickName = "TestPlayer7", Age = "99", Role = "Tester" }; TestPlayer8 = new Player { NickName = "TestPlayer8", Age = "99", Role = "Tester" }; TestPlayer9 = new Player { NickName = "TestPlayer9", Age = "99", Role = "Tester" }; TestPlayer10 = new Player { NickName = "TestPlayer10", Age = "99", Role = "Tester" }; //Team TestTeam1 = new Team { Name = "TeamTest1" }; TestTeam2 = new Team { Name = "TeamTest2" }; //Map TestMap = new Map { Name = "TestMap", IsActive = true }; //Match TestMatch = new Match { Format = "BOTest", Winner = TestTeam1 }; //Event TestEvent = new Event { Name = "TestEvent", GameName = "TestGO", Type = "Test", Held = false }; //Bet TestBet = new Bet { Amount = 500.00M, Odds = 1.78M, Type = TestMatch, WinCondition = TestTeam1 }; //Create user UserController.CreateUser(TestUser); //Create teams testTeam1Id = TeamController.CreateTeam(TestTeam1); testTeam2Id = TeamController.CreateTeam(TestTeam2); //Add players to team 1 TestTeam1.Players.Add(TestPlayer1); TestTeam1.Players.Add(TestPlayer2); TestTeam1.Players.Add(TestPlayer3); TestTeam1.Players.Add(TestPlayer4); TestTeam1.Players.Add(TestPlayer5); //Add team to players and create them foreach (Player p in TestTeam1.Players) { p.TeamId = testTeam1Id; p.Id = PlayerController.CreatePlayer(p); Debug.WriteLine("T1: " + p.Id); } //Update team with players TeamController.EditTeam(TestTeam1); //Add players to team 2 TestTeam2.Players.Add(TestPlayer6); TestTeam2.Players.Add(TestPlayer7); TestTeam2.Players.Add(TestPlayer8); TestTeam2.Players.Add(TestPlayer9); TestTeam2.Players.Add(TestPlayer10); //Add team to players and create them foreach (Player p in TestTeam2.Players) { p.TeamId = testTeam2Id; p.Id = PlayerController.CreatePlayer(p); Debug.WriteLine("T2: " + p.Id); } //Update team with players TeamController.EditTeam(TestTeam2); //Persist map testMapId = MatchController.CreateMap(TestMap); TestMap.Id = testMapId; //Add map to match TestMatch.Maps.Add(TestMap); TestMatch.Teams.Add(TestTeam1); TestMatch.Teams.Add(TestTeam2); //Persist event testEventId = EventController.CreateEvent(TestEvent); //Persist match TestMatch.EventId = testEventId; MatchController.CreateMatch(TestMatch); //Add match to event TestEvent.Matches.Add(TestMatch); }
/// <summary> /// Updates information about team /// </summary> /// <param name="team"></param> public void EditTeam(Team team) { teamController.EditTeam(team); }