public async Task TestConnectWithFakeTokenFails() { var mockLogger = new Mock <ILogger <DiscordProvider> >(); using (var provider = new DiscordProvider(mockLogger.Object, "asdf")) { Assert.IsFalse(await provider.Connect(default).ConfigureAwait(false));
public async Task TestAutomaticDiscordReconnection() { var discordToken = RequireDiscordToken(); using (var discordProvider = new DiscordProvider(Mock.Of <ILogger <DiscordProvider> >(), discordToken, 1)) { var connectResult = await discordProvider.Connect(default).ConfigureAwait(false);
public async Task TestConnectAndDisconnect() { if (testToken1 == null) { Assert.Inconclusive("Required environment variable TGS4_TEST_DISCORD_TOKEN isn't set!"); } var mockLogger = new Mock <ILogger <DiscordProvider> >(); await using var provider = new DiscordProvider(mockJobManager, Mock.Of <IAssemblyInformationProvider>(), mockLogger.Object, testToken1); Assert.IsFalse(provider.Connected); await provider.Disconnect(default).ConfigureAwait(false);
public async Task TestConnectWithFakeTokenFails() { var mockLogger = new Mock <ILogger <DiscordProvider> >(); await using var provider = new DiscordProvider(mockJobManager, Mock.Of <IAssemblyInformationProvider>(), mockLogger.Object, new ChatBot { ReconnectionInterval = 1, ConnectionString = "asdf" }); await Assert.ThrowsExceptionAsync <JobException>(() => InvokeConnect(provider)); Assert.IsFalse(provider.Connected); }
public async Task TestConnectWithFakeTokenFails() { var mockLogger = new Mock <ILogger <DiscordProvider> >(); using var provider = new DiscordProvider(Mock.Of <IAssemblyInformationProvider>(), mockLogger.Object, "asdf", 1); Assert.IsFalse(await provider.Connect(default).ConfigureAwait(false));