added more test timeouts

This commit is contained in:
Garry Newman 2018-01-31 11:28:47 +00:00
parent 5991839c27
commit 650d221baf
2 changed files with 44 additions and 7 deletions

View File

@ -122,12 +122,17 @@ public void Deserialize()
client.Inventory.Refresh();
var stopwatch = Stopwatch.StartNew();
//
// Block until we have the items
//
while ( client.Inventory.SerializedItems == null )
{
client.Update();
if (stopwatch.Elapsed.Seconds > 10)
throw new System.Exception("Getting SerializedItems took too long");
}
Assert.IsNotNull( client.Inventory.SerializedItems );
@ -140,7 +145,15 @@ public void Deserialize()
var result = server.Inventory.Deserialize( client.Inventory.SerializedItems );
server.UpdateWhile( () => result.IsPending );
stopwatch = Stopwatch.StartNew();
while (result.IsPending)
{
server.Update();
if (stopwatch.Elapsed.Seconds > 10)
throw new System.Exception("result took too long");
}
Assert.IsFalse( result.IsPending );
Assert.IsNotNull( result.Items );

View File

@ -73,10 +73,16 @@ public void GetLeaderboardCallback()
{
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
var time = Stopwatch.StartNew();
while ( !board.IsValid )
{
Thread.Sleep( 10 );
client.Update();
if (time.Elapsed.TotalSeconds > 10)
{
throw new Exception("board.IsValid took too long");
}
}
Assert.IsTrue( board.IsValid );
@ -115,10 +121,16 @@ public void AddScores()
{
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
var time = Stopwatch.StartNew();
while (!board.IsValid)
{
Thread.Sleep(10);
client.Update();
if (time.Elapsed.TotalSeconds > 10)
{
throw new Exception("board.IsValid took too long");
}
}
Assert.IsTrue( board.IsValid );
@ -153,10 +165,16 @@ public void AddScoresCallback()
{
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
var time = Stopwatch.StartNew();
while (!board.IsValid)
{
Thread.Sleep(10);
client.Update();
if (time.Elapsed.TotalSeconds > 10)
{
throw new Exception("board.IsValid took too long");
}
}
Assert.IsTrue( board.IsValid );
@ -189,10 +207,16 @@ public void AddFileAttachment()
{
var board = client.GetLeaderboard( "TestLeaderboard", Steamworks.Client.LeaderboardSortMethod.Ascending, Steamworks.Client.LeaderboardDisplayType.Numeric );
var time = Stopwatch.StartNew();
while (!board.IsValid)
{
Thread.Sleep(10);
client.Update();
if (time.Elapsed.TotalSeconds > 10)
{
throw new Exception("board.IsValid took too long");
}
}
Assert.IsTrue( board.IsValid );