You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using Discord.Rest;
- using System;
- using Xunit;
-
- namespace Discord
- {
- /// <summary>
- /// Test fixture type for integration tests which sets up the client from
- /// the token provided in environment variables.
- /// </summary>
- public class DiscordRestClientFixture : IDisposable
- {
- public DiscordRestClient Client { get; private set; }
-
- public DiscordRestClientFixture()
- {
- var token = Environment.GetEnvironmentVariable("DNET_TEST_TOKEN", EnvironmentVariableTarget.Process);
- if (string.IsNullOrWhiteSpace(token))
- throw new Exception("The DNET_TEST_TOKEN environment variable was not provided.");
- Client = new DiscordRestClient(new DiscordRestConfig()
- {
- DefaultRetryMode = RetryMode.AlwaysRetry
- });
- Client.LoginAsync(TokenType.Bot, token).Wait();
- }
-
- public void Dispose()
- {
- Client.LogoutAsync().Wait();
- Client.Dispose();
- }
- }
- }
|