mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 14:15:47 +03:00
Unit Test timeouts
This commit is contained in:
parent
8d202b4645
commit
5991839c27
@ -18,10 +18,16 @@ public void GetLeaderboard()
|
|||||||
{
|
{
|
||||||
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
|
||||||
|
|
||||||
|
var time = Stopwatch.StartNew();
|
||||||
while ( !board.IsValid )
|
while ( !board.IsValid )
|
||||||
{
|
{
|
||||||
Thread.Sleep( 10 );
|
Thread.Sleep( 10 );
|
||||||
client.Update();
|
client.Update();
|
||||||
|
|
||||||
|
if (time.Elapsed.TotalSeconds > 10 )
|
||||||
|
{
|
||||||
|
throw new Exception("board.IsValid took too long");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsTrue( board.IsValid );
|
Assert.IsTrue( board.IsValid );
|
||||||
@ -35,10 +41,16 @@ public void GetLeaderboard()
|
|||||||
|
|
||||||
board.FetchScores( Steamworks.Leaderboard.RequestType.Global, 0, 20 );
|
board.FetchScores( Steamworks.Leaderboard.RequestType.Global, 0, 20 );
|
||||||
|
|
||||||
|
time = Stopwatch.StartNew();
|
||||||
while ( board.IsQuerying )
|
while ( board.IsQuerying )
|
||||||
{
|
{
|
||||||
Thread.Sleep( 10 );
|
Thread.Sleep( 10 );
|
||||||
client.Update();
|
client.Update();
|
||||||
|
|
||||||
|
if (time.Elapsed.TotalSeconds > 10)
|
||||||
|
{
|
||||||
|
throw new Exception("board.IsQuerying took too long");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Assert.IsFalse( board.IsError );
|
Assert.IsFalse( board.IsError );
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Facepunch.Steamworks.Test
|
namespace Facepunch.Steamworks.Test
|
||||||
{
|
{
|
||||||
@ -395,6 +396,7 @@ public void DownloadFile()
|
|||||||
|
|
||||||
var item = client.Workshop.GetItem( 844466101 );
|
var item = client.Workshop.GetItem( 844466101 );
|
||||||
|
|
||||||
|
var time = Stopwatch.StartNew();
|
||||||
if ( !item.Installed )
|
if ( !item.Installed )
|
||||||
{
|
{
|
||||||
item.Download();
|
item.Download();
|
||||||
@ -404,6 +406,9 @@ public void DownloadFile()
|
|||||||
Thread.Sleep( 500 );
|
Thread.Sleep( 500 );
|
||||||
client.Update();
|
client.Update();
|
||||||
Console.WriteLine( "Download Progress: {0}", item.DownloadProgress );
|
Console.WriteLine( "Download Progress: {0}", item.DownloadProgress );
|
||||||
|
|
||||||
|
if (time.Elapsed.Seconds > 30)
|
||||||
|
throw new Exception("item.Installed Took Too Long");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user