mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-07-31 15:58:27 -04:00
* Move all unit tests to Engine/Tests * Fix Margin.EdgeSubtract * Fix Capsule.Contains * EnvironmentVariables.Remove if it's null * Fixed ray trace never returning startedsolid * Fix HistoryList.Navigate on empty list * Fix GameObject.WorldPosition accepting NaNs * Fix flex: initial expanding to the wrong grow/shrink * Translation.TryConvert shouldn't throw on invalid enum strings * Skip sound file tests on machines with no audio device
40 lines
757 B
C#
40 lines
757 B
C#
using System;
|
|
|
|
namespace ServicesTests;
|
|
|
|
[TestClass]
|
|
[TestCategory( "LiveBackend" )]
|
|
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 PlayerStats()
|
|
{
|
|
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 );
|
|
}
|
|
|
|
}
|