mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-23 20:17:58 +03:00
App tests
This commit is contained in:
parent
f10dd56ddd
commit
e9c913beea
56
Facepunch.Steamworks.Test/Client/App.cs
Normal file
56
Facepunch.Steamworks.Test/Client/App.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Facepunch.Steamworks.Test
|
||||
{
|
||||
[TestClass]
|
||||
[DeploymentItem( "steam_api.dll" )]
|
||||
[DeploymentItem( "steam_api64.dll" )]
|
||||
[DeploymentItem( "steam_appid.txt" )]
|
||||
public class App
|
||||
{
|
||||
[TestMethod]
|
||||
public void IsSubscribed()
|
||||
{
|
||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
||||
{
|
||||
Console.WriteLine("This test assumes you own Garry's Mod and not Charles III of Spain and the antiquity");
|
||||
|
||||
Assert.IsTrue( client.App.IsSubscribed( 4000 ) );
|
||||
Assert.IsFalse( client.App.IsSubscribed( 590440 ));
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsInstalled()
|
||||
{
|
||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
||||
{
|
||||
Console.WriteLine("This test assumes you have Garry's Mod installed but not Charles III of Spain and the antiquity");
|
||||
|
||||
Assert.IsTrue(client.App.IsInstalled(4000));
|
||||
Assert.IsFalse(client.App.IsInstalled(590440));
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PurchaseTime()
|
||||
{
|
||||
using (var client = new Facepunch.Steamworks.Client(252490))
|
||||
{
|
||||
Console.WriteLine("This test assumes you own Garry's Mod but not Charles III of Spain and the antiquity");
|
||||
|
||||
var gmodBuyTime = client.App.PurchaseTime( 4000 );
|
||||
Assert.AreNotEqual( gmodBuyTime, DateTime.MinValue );
|
||||
|
||||
Console.WriteLine($"You bought Garry's Mod {gmodBuyTime}");
|
||||
|
||||
var otherBuyTime = client.App.PurchaseTime(590440);
|
||||
Assert.AreEqual(otherBuyTime, DateTime.MinValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -94,6 +94,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Client\Client.cs" />
|
||||
<Compile Include="Client\Leaderboard.cs" />
|
||||
<Compile Include="Client\App.cs" />
|
||||
<Compile Include="Client\Voice.cs" />
|
||||
<Compile Include="Client\Inventory.cs" />
|
||||
<Compile Include="Client\Workshop.cs" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user