Skip to content

Commit f390692

Browse files
committed
Add rules api test
1 parent f234e49 commit f390692

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

SteamQueryNet/SteamQueryNet.Tests/ServerQueryTests.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using System.Linq;
1313
using System.Net;
1414
using System.Net.Sockets;
15-
15+
using System.Threading.Tasks;
1616
using Xunit;
1717

1818
namespace SteamQueryNet.Tests
@@ -113,6 +113,28 @@ public void GetPlayers_ShouldPopulateCorrectPlayers()
113113
}
114114
}
115115

116+
/*
117+
* We keep this test here to be able to have us a notifier when the Rules API becomes available.
118+
* So, this is more like an integration test than an unit test.
119+
* If this test starts to fail, we'll know that the Rules API started to respond.
120+
*/
121+
[Fact]
122+
public void GetRules_ShouldThrowTimeoutException()
123+
{
124+
// Surf Heaven rulez.
125+
const string trustedServer = "steam://connect/54.37.111.217:27015";
126+
127+
using (var sq = new ServerQuery())
128+
{
129+
sq.Connect(trustedServer);
130+
131+
// Make sure that the server is still alive.
132+
Assert.True(sq.IsConnected);
133+
bool responded = Task.WaitAll(new Task[] { sq.GetRulesAsync() }, 2000);
134+
Assert.True(!responded);
135+
}
136+
}
137+
116138
private void SetupRequestCompare(IEnumerable<byte[]> requestPackets, Mock<IUdpClient> udpClientMock)
117139
{
118140
udpClientMock

0 commit comments

Comments
 (0)