mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-02-14 16:45:42 -05:00
- Added Sandbox.Test.Unit project (contains independent tests that can run in parallel) - Modify some slow/stress tests (e.g. instead of doing a million iterations settle for 10k). Tests run almost twice as fast now.
39 lines
721 B
C#
39 lines
721 B
C#
using System;
|
|
|
|
namespace Services;
|
|
|
|
[TestClass]
|
|
public class StatsTest
|
|
{
|
|
[TestMethod]
|
|
public async Task GlobalStats()
|
|
{
|
|
var stats = Sandbox.Services.Stats.GetGlobalStats( "facepunch.ss1" );
|
|
|
|
await stats.Refresh();
|
|
|
|
foreach ( var stat in stats )
|
|
{
|
|
Console.WriteLine( $"{stat.Name} value: {stat.Value} players: {stat.Players}" );
|
|
}
|
|
|
|
Assert.IsTrue( stats.Count() > 0 );
|
|
}
|
|
|
|
[TestMethod]
|
|
public async Task PlayertStats()
|
|
{
|
|
var stats = Sandbox.Services.Stats.GetPlayerStats( "facepunch.ss1", 76561197960279927 );
|
|
|
|
await stats.Refresh();
|
|
|
|
foreach ( var stat in stats )
|
|
{
|
|
Console.WriteLine( $"{stat.Name} value: {stat.Value} last: {stat.Last}" );
|
|
}
|
|
|
|
Assert.IsTrue( stats.Count() > 0 );
|
|
}
|
|
|
|
}
|