Adding unit tests
This commit is contained in:
@@ -18,26 +18,26 @@ public class PlayerService
|
||||
_players = db.GetCollection<Player>("Players");
|
||||
}
|
||||
|
||||
public async Task<Player> GetByUserIdAsync(string userId) =>
|
||||
public virtual async Task<Player> GetByUserIdAsync(string userId) =>
|
||||
await _players.Find(p => p.UserId == userId).FirstOrDefaultAsync();
|
||||
|
||||
public async Task<List<Player>> GetByLocationIdAsync(string locationId)
|
||||
public virtual async Task<List<Player>> GetByLocationIdAsync(string locationId)
|
||||
{
|
||||
return await _players.Find(p => p.LocationId == locationId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Player> GetByIdAsync(string id) =>
|
||||
public virtual async Task<Player> GetByIdAsync(string id) =>
|
||||
await _players.Find(p => p.Id == id).FirstOrDefaultAsync();
|
||||
|
||||
public async Task CreateAsync(Player player) =>
|
||||
public virtual async Task CreateAsync(Player player) =>
|
||||
await _players.InsertOneAsync(player);
|
||||
|
||||
public async Task UpdateAsync(Player player)
|
||||
public virtual async Task UpdateAsync(Player player)
|
||||
{
|
||||
await _players.ReplaceOneAsync(p => p.Id == player.Id, player);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string id)
|
||||
public virtual async Task DeleteAsync(string id)
|
||||
{
|
||||
await _players.DeleteOneAsync(p => p.Id == id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user