public async Task ServerInfo() { var mq = new SourceMasterQuery("dayz"); var servers = await mq.GetParsedServers(false, 200).ConfigureAwait(false); //TODO: not all servers returned will respond, allow timeout or verify good servers? servers = servers.OrderBy(x => Guid.NewGuid()).Take(3); foreach (var d in servers) { var split = d.Settings["address"].Split(':'); var sq = new SourceServerQuery(new ServerAddress(IPAddress.Parse(split[0]), Convert.ToInt32(split[1])), "dayz", new SourceQueryParser()); var state = new ServerQueryState {Server = A.Fake<Server>()}; await sq.UpdateAsync(state).ConfigureAwait(false); state.Exception.Should().BeNull(); state.Success.Should().BeTrue(); } }
public Task<IEnumerable<ServerQueryResult>> Query(SourceServersQuery query) { var gamespyQuery = new SourceMasterQuery(query.Tag); return gamespyQuery.GetParsedServers(); }
public async Task ServerList() { var mq = new SourceMasterQuery(""); var result = await mq.GetParsedServers().ConfigureAwait(false); result = result.ToArray(); result.Should().NotBeEmpty(); }