public void TestDiscordActivity() { var discord = DiscordsApp.GetApp(); discord.ClientId = 634555224123506698; discord.StartFailure += DiscordOnStartFailure; discord.Started += DiscordOnStarted; discord.HasException += DiscordOnHasException; discord.Stopped += DiscordOnStopped; discord.ActivityCallBack += DiscordOnActivityCallBack; discord.StartApp(); //Initialize a Mock of playing in a group see Mock Activity for options. MockActivity.SetMockGroupActivity(discord); //Send to update Queue discord.UpdateActivity(); var expireTime = DateTime.UtcNow + TimeSpan.FromSeconds(10); //Start a loop in order to receive the callbacks discord.StartLoop(); Assert.AreEqual(true, HasHit); HasHit = false; //Create a loop to process the call-backs until there is a response (or it reaches the expire time) while (!HasHit && DateTime.UtcNow < expireTime) { } Assert.AreEqual(true, HasHit); }
public void TestStartDiscord() { var discord = DiscordsApp.GetApp(); discord.ClientId = 2312323123123123123; discord.StartFailure += DiscordOnStartFailure; discord.Started += DiscordOnStarted; discord.HasException += DiscordOnHasException; discord.Stopped += DiscordOnStopped; discord.StartApp(); Assert.AreEqual(true, discord.Running); var expireTime = DateTime.UtcNow + TimeSpan.FromSeconds(10); while (!HasHit && DateTime.UtcNow < expireTime) { } Assert.AreEqual(true, HasHit); }
private void DiscordOnStartedActivity(object sender, EventArgs e) { HasHit = true; DiscordsApp.GetApp().StartLoop(); }