I have this function in my interface and it creates a new PlayersBadge entry in the db. I have to write unit tests for and I'm stuck.
public void Badge(int pID, int bID, int gID = 0)
{
var list = EliminationDbContext.PlayerBadges.Where(x=>x.Badge.BadgeID.Equals(bID) && x.Player.PlayerID.Equals(pID));
//if player doesn't have Badge create new Badge
if (list.Any() != true)
{
PlayerBadge b = new PlayerBadge { PlayerID = pID, BadgeID = bID, DateEarned = DateTime.Today, GameID = gID };
EliminationDbContext.PlayerBadges.Add(b);
EliminationDbContext.SaveChanges();
}
}
Aucun commentaire:
Enregistrer un commentaire