public void GetChannelForUser()
 {
     this.TestWrapper(async(MixerClient client) =>
     {
         ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(client);
     });
 }
예제 #2
0
        public void UpdateUserRoles()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                UserModel user = await connection.Users.GetUser("ChannelOne");

                Assert.IsNotNull(user);

                bool result = await connection.Channels.UpdateUserRoles(channel, user, new List <string>()
                {
                    "Mod"
                }, null);

                Assert.IsTrue(result);

                IEnumerable <UserWithGroupsModel> userRoles = await connection.Channels.GetUsersWithRoles(channel, "Mod");

                Assert.IsNotNull(userRoles);
                Assert.IsTrue(userRoles.Any(ug => ug.username.Equals("ChannelOne")));

                result = await connection.Channels.UpdateUserRoles(channel, user, null, new List <string>()
                {
                    "Mod"
                });

                Assert.IsTrue(result);

                userRoles = await connection.Channels.GetUsersWithRoles(channel, "Mod");

                Assert.IsNotNull(userRoles);
                Assert.IsFalse(userRoles.Any(ug => ug.username.Equals("ChannelOne")));
            });
        }
        public void CreateGetUpdateDeleteGame()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                InteractiveGameListingModel gameListing = await InteractiveServiceUnitTests.CreateTestGame(connection, channel);

                IEnumerable <InteractiveGameListingModel> games = await connection.Interactive.GetOwnedInteractiveGames(channel);

                Assert.IsNotNull(games);
                Assert.IsTrue(games.Count() > 0);
                Assert.IsTrue(games.Any(g => g.id.Equals(gameListing.id)));

                string gameName           = gameListing.name = "Test Game";
                InteractiveGameModel game = await connection.Interactive.UpdateInteractiveGame(gameListing);

                Assert.IsNotNull(game);
                Assert.IsTrue(game.id > 0);
                Assert.AreEqual(game.name, gameName);

                await InteractiveServiceUnitTests.DeleteTestGame(connection, game);

                games = await connection.Interactive.GetOwnedInteractiveGames(channel);

                Assert.IsNotNull(games);
                Assert.IsFalse(games.Any(g => g.id.Equals(game.id)));
            });
        }
예제 #4
0
        public void GetPreferences()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                ChannelPreferencesModel preference = await connection.Channels.GetPreferences(channel);

                Assert.IsNotNull(preference);

                preference.linksClickable = !preference.linksClickable;

                ChannelPreferencesModel newPreferences = await connection.Channels.UpdatePreferences(channel, preference);

                Assert.IsNotNull(newPreferences);
                Assert.AreEqual(preference.linksClickable, newPreferences.linksClickable);

                preference.linksClickable = !preference.linksClickable;

                newPreferences = await connection.Channels.UpdatePreferences(channel, preference);

                Assert.IsNotNull(newPreferences);
                Assert.AreEqual(preference.linksClickable, newPreferences.linksClickable);
            });
        }
예제 #5
0
 public void GetChannelForUser()
 {
     TestWrapper(async(MixerConnection connection) =>
     {
         ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);
     });
 }
예제 #6
0
        public void GetUpdateDiscord()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                DiscordBotModel discord = await connection.Channels.GetDiscord(channel);

                Assert.IsNotNull(discord);
                Assert.IsTrue(discord.id > 0);

                IEnumerable <DiscordChannelModel> channels = await connection.Channels.GetDiscordChannels(channel);

                Assert.IsNotNull(channels);
                Assert.IsTrue(channels.Count() > 0);

                IEnumerable <DiscordRoleModel> roles = await connection.Channels.GetDiscordRoles(channel);

                Assert.IsNotNull(roles);
                Assert.IsTrue(roles.Count() > 0);

                discord = await connection.Channels.UpdateDiscord(channel, discord);

                Assert.IsNotNull(discord);
                Assert.IsTrue(discord.id > 0);
            });
        }
        public static void ClassInitialize(TestContext context)
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                testGameListing = await InteractiveServiceUnitTests.CreateTestGame(connection, channel);
            });
        }
예제 #8
0
        public static async Task <ChannelChatModel> GetChat(MixerClient client)
        {
            ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(client);

            ChannelChatModel chat = await client.Chats.GetChat(channel);

            Assert.IsNotNull(chat);
            Assert.IsTrue(chat.endpoints.Count() > 0);

            return(chat);
        }
예제 #9
0
        public void GetHosters()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <ChannelAdvancedModel> hosters = await connection.Channels.GetHosters(channel, 1);

                Assert.IsNotNull(hosters);
            });
        }
        public void GetSharedInteractiveGames()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <InteractiveGameListingModel> games = await connection.Interactive.GetSharedInteractiveGames(channel);

                Assert.IsNotNull(games);
            });
        }
예제 #11
0
        public static async Task <UserModel> GetCurrentUser(MixerClient client)
        {
            ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(client);

            PrivatePopulatedUserModel user = await client.Users.GetCurrentUser();

            Assert.IsNotNull(user);
            Assert.IsTrue(user.id > (uint)0);

            return(user);
        }
예제 #12
0
        public void GetAllTimeSparksLeaderboard()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <SparksLeaderboardModel> leaderboard = await connection.Leaderboards.GetAllTimeSparksLeaderboard(channel);
                Assert.IsNotNull(leaderboard);
                Assert.IsTrue(leaderboard.Count() >= 0);
            });
        }
예제 #13
0
        public static void ClassInitialize(TestContext context)
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);
                chatClient           = await ChatClient.CreateFromChannel(connection, channel);

                Assert.IsTrue(await chatClient.Connect());
                Assert.IsTrue(await chatClient.Authenticate());
            });
        }
        public void GetHosters()
        {
            this.TestWrapper(async(MixerClient client) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(client);

                IEnumerable <ChannelAdvancedModel> hosters = await client.Channels.GetHosters(channel);

                Assert.IsNotNull(hosters);
            });
        }
예제 #15
0
        public void GetUsers()
        {
            this.TestWrapper(async(MixerClient client) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(client);

                IEnumerable <ChatUserModel> users = await client.Chats.GetUsers(channel);

                Assert.IsNotNull(users);
                Assert.IsTrue(users.Count() > 0);
            });
        }
예제 #16
0
        public void GetFollowers()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <UserWithChannelModel> users = await connection.Channels.GetFollowers(channel, 1);

                Assert.IsNotNull(users);
                Assert.IsTrue(users.Count() > 0);
            });
        }
예제 #17
0
        public void GetSubscriberAnalytics()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <SubscriberAnalyticModel> subscribers = await connection.Channels.GetSubscriberAnalytics(channel, DateTimeOffset.Now.Subtract(TimeSpan.FromDays(7)));

                Assert.IsNotNull(subscribers);
                Assert.IsTrue(subscribers.Count() > 0);
            });
        }
        public static void ClassInitialize(TestContext context)
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                testGameListing = await InteractiveServiceUnitTests.CreateTestGame(connection, channel);

                interactiveClient = await InteractiveClient.CreateFromChannel(connection, channel, testGameListing);

                Assert.IsTrue(await interactiveClient.Connect());
                Assert.IsTrue(await interactiveClient.Ready());
            });
        }
예제 #19
0
        public void UpdateChannel()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                string newName = "Test Name";
                channel.name   = newName;

                channel = await connection.Channels.UpdateChannel(channel);

                Assert.IsNotNull(channel);
                Assert.IsTrue(string.Equals(channel.name, newName));
            });
        }
예제 #20
0
        public void GetChannelEmoticons()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);
                UserModel user       = await connection.Users.GetCurrentUser();

                Assert.IsNotNull(user);
                Assert.IsTrue(user.id > (uint)0);

                IEnumerable <EmoticonPackModel> emoticonPacks = await connection.Channels.GetEmoticons(channel, user);

                Assert.IsNotNull(emoticonPacks);
            });
        }
예제 #21
0
        public void GetChannelBroadcast()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                Assert.IsNotNull(channel);
                Assert.IsTrue(channel.id > (uint)0);

                BroadcastModel broadcast = await connection.Channels.GetCurrentBroadcast(channel);

                Assert.IsNotNull(broadcast);
                Assert.AreEqual(channel.id, broadcast.channelId);
            });
        }
예제 #22
0
        public void GetChannelRecordings()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                Assert.IsNotNull(channel);
                Assert.IsTrue(channel.id > (uint)0);

                IEnumerable <ChannelRecordingModel> recordings = await connection.Channels.GetRecordings(channel);

                Assert.IsNotNull(recordings);
                Assert.IsTrue(recordings.Count() > 0);
            });
        }
예제 #23
0
        public void LiveSubscribeAndUnsubscribe()
        {
            this.ConstellationWrapper(async(MixerConnection connection, ConstellationClient constellationClient) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                this.ClearPackets();

                ConstellationEventType eventType = new ConstellationEventType(ConstellationEventTypeEnum.channel__id__update, channel.id);
                Assert.IsTrue(await constellationClient.SubscribeToEventsWithResponse(new List <ConstellationEventType>()
                {
                    eventType
                }));

                this.ClearPackets();

                bool eventReceived = false;
                constellationClient.OnSubscribedEventOccurred += (sender, le) =>
                {
                    if (le.channel.Equals(eventType.ToString()))
                    {
                        eventReceived = true;
                    }
                };

                string newName = "Test Name - " + DateTimeOffset.Now;
                channel.name   = newName;

                channel = await connection.Channels.UpdateChannel(channel);

                Assert.IsNotNull(channel);
                Assert.IsTrue(string.Equals(channel.name, newName));

                this.ClearPackets();

                await Task.Delay(5000);

                if (!eventReceived)
                {
                    Assert.Fail("Did not get live event for channel updating");
                }

                Assert.IsTrue(await constellationClient.UnsubscribeToEventsWithResponse(new List <ConstellationEventType>()
                {
                    eventType
                }));
            });
        }
        public void GetInteractiveVersion()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <InteractiveGameListingModel> games = await connection.Interactive.GetOwnedInteractiveGames(channel);

                Assert.IsNotNull(games);
                Assert.IsTrue(games.Count() > 0);

                InteractiveGameVersionModel version = await connection.Interactive.GetInteractiveGameVersion(games.First().versions.First());

                Assert.IsNotNull(version);
            });
        }
        public void GetUsers()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <ChatUserModel> users = await connection.Chats.GetUsers(channel);

                Assert.IsNotNull(users);

                if (users.Count() > 0)
                {
                    ChatUserModel user = await connection.Chats.GetUser(channel, users.First().userId.GetValueOrDefault());
                }
            });
        }
예제 #26
0
        public void GetUserFanProgression()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                IEnumerable <UserWithGroupsModel> users = await connection.Channels.GetUsersWithRoles(channel, 1);

                Assert.IsNotNull(users);
                Assert.IsTrue(users.Count() > 0);

                UserFanProgressionModel userFanProgression = await connection.Channels.GetUserFanProgression(channel, users.First());

                Assert.IsNotNull(userFanProgression);
                Assert.AreEqual(userFanProgression.userId, users.First().id);
            });
        }
예제 #27
0
        public void CheckGetDiscordInvite()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                UserModel user = await connection.Users.GetCurrentUser();

                bool result = await connection.Channels.CanUserGetDiscordInvite(channel, user);

                Assert.IsTrue(result);

                string invite = await connection.Channels.GetUserDiscordInvite(channel, user);

                Assert.IsNotNull(invite);
                Assert.IsTrue(invite.Length > 0);
            });
        }
예제 #28
0
        public void CheckIfUsersHaveRole()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                UserModel modUser    = await connection.Users.GetUser("SXTBot");
                UserModel notModUser = await connection.Users.GetUser("ChannelOne");

                Dictionary <uint, DateTimeOffset?> usersWithRole = await connection.Channels.CheckIfUsersHaveRole(channel, new List <UserModel>()
                {
                    modUser, notModUser
                }, "Mod");
                Assert.IsNotNull(usersWithRole);
                Assert.IsTrue(usersWithRole.Count == 1);
                Assert.IsNotNull(usersWithRole.ContainsKey(modUser.id));
            });
        }
예제 #29
0
        private void ChatWrapper(Func <MixerClient, ChatClient, Task> function)
        {
            this.TestWrapper(async(MixerClient client) =>
            {
                ChannelModel channel  = await ChannelsServiceUnitTests.GetChannel(client);
                ChatClient chatClient = await ChatClient.CreateFromChannel(client, channel);

                chatClient.ReplyOccurred      += ChatClient_ReplyOccurred;
                chatClient.EventOccurred      += ChatClient_EventOccurred;
                chatClient.DisconnectOccurred += ChatClient_DisconnectOccurred;

                chatClient.MessageOccurred += ChatClient_MessageOccurred;

                Assert.IsTrue(await chatClient.Connect());

                await function(client, chatClient);

                await chatClient.Disconnect();
            });
        }
예제 #30
0
        public void UpdateChannelGame()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection);

                string gameName = "Fortnite";
                IEnumerable <GameTypeSimpleModel> games = await connection.GameTypes.GetGameTypes(gameName);

                Assert.IsNotNull(games);
                Assert.IsTrue(games.Count() > 0);
                Assert.IsTrue(games.Any(gt => gt.name.Equals(gameName)));

                channel.typeId = games.First().id;

                channel = await connection.Channels.UpdateChannel(channel);

                Assert.IsNotNull(channel);
                Assert.IsTrue(channel.typeId == games.First().id);
            });
        }