public void AuthorizeTwitch_RedirectToCorrectUrl_UrlContainsTwitchUrl() { using (var controller = new TwitchController(new TwitchIntegrationStub(), new SessionHelperFake())) { var results = controller.AuthorizeTwitch() as RedirectResult; string expectedUrl = "https://api.twitch.tv/kraken/oauth2/authorize"; Assert.IsTrue(results.Url.Contains(expectedUrl)); } }
private void Awake() { if (_instance != null && _instance != this) { Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); _instance = this; } }
public async Task DeAuthorize_SuccessfullDeAuthorizationReturnsCorrectAction_ExpectedActionEqualsActual() { var session = new SessionHelperFake(); var user = new User { ID = 2, }; session.Add("CurrentUser", user); using (var controller = new TwitchController(new TwitchIntegrationStub(), session)) { var results = await controller.DeAuthorize() as RedirectToRouteResult; string expectedController = "Account"; string expectedAction = "EditIntegrations"; Assert.AreEqual(expectedController, results.RouteValues["Controller"]); Assert.AreEqual(expectedAction, results.RouteValues["Action"]); } }
public EventLookup(TwitchController twitchController) { controller = twitchController; }
private static void Main(string[] args) { if (args.Length >= 1) ProcessArgs(args); else return; var initTwitch = new Twitch(_twitchChannel); var twitchController = new TwitchController(); Console.WriteLine("Version: {0}", initTwitch.Configuration.Version); Console.WriteLine("Channel: {0}", initTwitch.Configuration.Channel); // parse that data twitchController.ApiRequest<Chat>($"group/user/{initTwitch.Configuration.Channel}/chatters", TwitchController.RequestType.Tmi); twitchController.ApiRequest<Channel>($"channels/{initTwitch.Configuration.Channel}", TwitchController.RequestType.Kraken); twitchController.ApiRequest<ChatBadges>($"chat/{initTwitch.Configuration.Channel}/badges", TwitchController.RequestType.Kraken); twitchController.ApiRequest<ChatEmoticons>("chat/emoticon_images", TwitchController.RequestType.Kraken); twitchController.ApiRequest<GamesTop>("games/top", TwitchController.RequestType.Kraken); twitchController.ApiRequest<StreamLive>($"streams/{initTwitch.Configuration.Channel}", TwitchController.RequestType.Kraken); twitchController.ApiRequest<IngestServer>("ingests", TwitchController.RequestType.Kraken); twitchController.ApiRequest<User>($"users/{initTwitch.Configuration.Channel}", TwitchController.RequestType.Kraken); twitchController.ApiRequest<UserVideos>($"channels/{initTwitch.Configuration.Channel}/videos?broadcasts=true", TwitchController.RequestType.Kraken); initTwitch = twitchController.Twitch; Console.WriteLine("-----------------------------------------"); // test parsed data (make sure it's not returning null) Console.WriteLine("Chatter Count: {0}", initTwitch.Chat.ChatterCount); Console.WriteLine("Channel Display Name: {0}", initTwitch.Channel.DisplayName); Console.WriteLine("Test Mod Image: {0}", initTwitch.ChatBadges.Mod.Image); Console.WriteLine("Emote: {0}", initTwitch.ChatEmoticons.Emoticons[0].Code); var iGames = initTwitch.GamesTop.Top.Count; Console.Write("Top ({0}) Games: ", iGames); foreach (var game in initTwitch.GamesTop.Top) { if (iGames != 1) Console.Write("{0}, ", game.Game.Name); else Console.WriteLine(game.Game.Name); iGames--; } if (initTwitch.StreamLive.Stream != null) Console.WriteLine("Viewers: {0}", initTwitch.StreamLive.Stream.Viewers); var iIngests = initTwitch.IngestServer.Ingests.Count; Console.Write("Top ({0}) Ingests: ", iIngests); foreach (var server in initTwitch.IngestServer.Ingests) { if (iIngests != 1) Console.Write("\"{0}\", ", server.Name); else Console.WriteLine(server.Name); iIngests--; } Console.WriteLine("Bio: {0}", initTwitch.User.Bio); Console.WriteLine("User Video: {0}", initTwitch.UserVideos.Total); Console.ReadKey(); }
private void Start() { twitchController = TwitchController.Instance; maxCreatureInput.text = PlayerPrefs.GetInt(GameController.MAX_CREATURES_KEY, 50).ToString(); allowMultipleCreatures.isOn = PlayerPrefs.GetInt(GameController.ALLOW_MULTIPLE_CREATURES) != 0; }