mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-21 04:40:00 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
39 lines
723 B
C#
39 lines
723 B
C#
using System;
|
|
|
|
namespace TestSystem;
|
|
|
|
[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 );
|
|
}
|
|
|
|
}
|