2017-07-25 20:09:41 +03:00
|
|
|
|
using System;
|
2017-07-28 12:20:28 +03:00
|
|
|
|
using System.Diagnostics;
|
2017-07-25 20:09:41 +03:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
|
|
|
|
namespace Facepunch.Steamworks.Test
|
|
|
|
|
{
|
2017-07-28 12:20:28 +03:00
|
|
|
|
[TestClass]
|
2017-07-25 20:09:41 +03:00
|
|
|
|
[DeploymentItem("steam_api.dll")]
|
|
|
|
|
[DeploymentItem("steam_api64.dll")]
|
|
|
|
|
[DeploymentItem("steam_appid.txt")]
|
2017-07-28 12:20:28 +03:00
|
|
|
|
public class Lobby
|
2017-07-25 20:09:41 +03:00
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
2017-07-28 12:20:28 +03:00
|
|
|
|
public void CreateLobby()
|
2017-07-25 20:09:41 +03:00
|
|
|
|
{
|
|
|
|
|
using (var client = new Facepunch.Steamworks.Client(252490))
|
|
|
|
|
{
|
|
|
|
|
Assert.IsTrue(client.IsValid);
|
|
|
|
|
|
2017-07-28 12:20:28 +03:00
|
|
|
|
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
2017-07-25 20:09:41 +03:00
|
|
|
|
|
2017-07-28 12:20:28 +03:00
|
|
|
|
client.Lobby.OnLobbyCreated = (success) =>
|
|
|
|
|
{
|
|
|
|
|
Assert.IsTrue(success);
|
|
|
|
|
Assert.IsTrue(client.Lobby.IsValid);
|
|
|
|
|
Console.WriteLine(client.Lobby.CurrentLobby);
|
|
|
|
|
client.Lobby.Leave();
|
|
|
|
|
};
|
2017-07-25 20:09:41 +03:00
|
|
|
|
|
2017-07-28 12:20:28 +03:00
|
|
|
|
var sw = Stopwatch.StartNew();
|
|
|
|
|
|
|
|
|
|
while (sw.Elapsed.TotalSeconds < 3)
|
2017-07-25 20:09:41 +03:00
|
|
|
|
{
|
2017-07-28 12:20:28 +03:00
|
|
|
|
client.Update();
|
|
|
|
|
System.Threading.Thread.Sleep(10);
|
2017-07-25 20:09:41 +03:00
|
|
|
|
}
|
2017-07-28 12:20:28 +03:00
|
|
|
|
|
2017-07-25 20:09:41 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|