public void RepoGamerTestsUpdateGamerMT() { List <Gamer> gamerdb = new List <Gamer> { new Gamer { GamerID = 0, Active = true }, new Gamer { GamerID = 1, Active = true } }; MainTeam t = new MainTeam { MainTeamID = 0, TeamName = "stk" }; _gamerSet.Object.AddRange(gamerdb); ConnectMocksToDataStore(gamerdb); Gamer expected = new Gamer { GamerID = 0, Active = false, MainTeam = t }; bool testcall = _repo.UpdateGamerMainTeam(0, t); Gamer actual = _repo.GetGamerById(0); Assert.AreEqual(expected, actual); Assert.IsTrue(testcall); }
public void RepoTeamInviteTestsGetTeamInvitesByTeamID() { MainTeam mt = new MainTeam { MainTeamID = 0 }; TeamInvite invite = new TeamInvite { Team = mt, Accepted = true }; TeamInvite invite2 = new TeamInvite { Team = mt, Accepted = false }; List <TeamInvite> expected = new List <TeamInvite> { invite, invite2 }; List <TeamInvite> inviteDB = new List <TeamInvite> { invite, invite2, new TeamInvite { Team = new MainTeam { MainTeamID = 1 } } }; _inviteSet.Object.AddRange(inviteDB); ConnectMocksToDataStore(inviteDB); List <TeamInvite> actual = _repo.getInvitesByTeamID(0); Assert.AreEqual(2, actual.Count); Assert.IsNotNull(_inviteSet.Object); CollectionAssert.AreEqual(expected, actual); }
public void RepoTeamInviteTestsUpdateAccepted() { Gamer g = new Gamer { GamerID = 0 }; Gamer g2 = new Gamer { GamerID = 1 }; MainTeam t = new MainTeam { MainTeamID = 0 }; List <TeamInvite> inviteDB = new List <TeamInvite> { new TeamInvite { TeamInviteID = 0, Team = t, InvitedGamer = g, Accepted = false }, new TeamInvite { TeamInviteID = 1, Team = t, InvitedGamer = g2, Accepted = false }, }; _inviteSet.Object.AddRange(inviteDB); ConnectMocksToDataStore(inviteDB); TeamInvite expected = new TeamInvite { TeamInviteID = 0, Team = t, InvitedGamer = g, Accepted = true }; bool result = _repo.UpdateTeamInviteAccepted(0, true); TeamInvite actual = _repo.GetTeamInviteById(0); Assert.AreEqual(expected.Accepted, actual.Accepted); Assert.IsTrue(result); }
public void RepoTeamTestsAddAMainTeam() { List <MainTeam> db = new List <MainTeam>(); _teamSet.Object.AddRange(db); _teamSet.Setup(o => o.Add(It.IsAny <MainTeam>())).Callback((MainTeam f) => db.Add(f)); ConnectMocksToDataStore(db); MainTeam t = new MainTeam { MainTeamID = 0 }; bool result = _repo.AddNewMainTeam(t); List <MainTeam> expected = new List <MainTeam> { t }; List <MainTeam> actual = _repo.GetAllMainTeams(); Assert.IsTrue(result); CollectionAssert.AreEqual(expected, actual); }
public void RepoTeamInviteTestsGetInvitesByGamerID() { Gamer g = new Gamer { GamerID = 0 }; Gamer g2 = new Gamer { GamerID = 1 }; MainTeam t = new MainTeam { MainTeamID = 0 }; List <TeamInvite> db = new List <TeamInvite> { new TeamInvite { TeamInviteID = 0, Team = t, InvitedGamer = g }, new TeamInvite { TeamInviteID = 1, Team = t, InvitedGamer = g2 } }; _inviteSet.Object.AddRange(db); ConnectMocksToDataStore(db); List <TeamInvite> expected = new List <TeamInvite> { new TeamInvite { TeamInviteID = 0, Team = t, InvitedGamer = g } }; List <TeamInvite> actual = _repo.GetTeamInvitesByGamerID(0); Assert.IsNotNull(actual); Assert.AreEqual(1, actual.Count); CollectionAssert.AreEqual(expected, actual); }