public void GetCurrentUser()
 {
     TestWrapper(async(MixerConnection connection) =>
     {
         UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);
     });
 }
        public void UpdatePreferences()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                UserPreferencesModel preferences = await connection.Users.GetPreferences(user);

                Assert.IsNotNull(preferences);

                preferences.chatLurkMode = !preferences.chatLurkMode;

                UserPreferencesModel newPreferences = await connection.Users.UpdatePreferences(user, preferences);

                Assert.IsNotNull(preferences);
                Assert.AreEqual(preferences.chatLurkMode, newPreferences.chatLurkMode);

                preferences.chatLurkMode = !preferences.chatLurkMode;

                newPreferences = await connection.Users.UpdatePreferences(user, preferences);

                Assert.IsNotNull(preferences);
                Assert.AreEqual(preferences.chatLurkMode, newPreferences.chatLurkMode);
            });
        }
        public static async Task<MixPlayGameListingModel> CreateTestGame(MixerConnection connection, ChannelModel channel)
        {
            UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

            IEnumerable<MixPlayGameListingModel> gameListings = await connection.MixPlay.GetOwnedMixPlayGames(channel);

            MixPlayGameListingModel previousTestGame = gameListings.FirstOrDefault(g => g.name.Equals(MixPlayServiceUnitTests.GameName));
            if (previousTestGame != null)
            {
                await MixPlayServiceUnitTests.DeleteTestGame(connection, previousTestGame);
            }

            MixPlayGameModel game = new MixPlayGameModel()
            {
                name = MixPlayServiceUnitTests.GameName,
                ownerId = user.id,             
            };
            game = await connection.MixPlay.CreateMixPlayGame(game);

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

            game.controlVersion = "2.0";
            game = await connection.MixPlay.UpdateMixPlayGame(game);

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

            gameListings = await connection.MixPlay.GetOwnedMixPlayGames(channel);

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

            MixPlayGameListingModel gameListing = gameListings.FirstOrDefault(gl => gl.id.Equals(game.id));
            Assert.IsNotNull(gameListing);

            MixPlayGameVersionModel version = gameListing.versions.First();
            MixPlaySceneModel defaultScene = new MixPlaySceneModel()
            {
                sceneID = "default",
            };

            defaultScene.buttons.Add(MixPlayClientUnitTests.CreateTestButton());
            defaultScene.joysticks.Add(MixPlayClientUnitTests.CreateTestJoystick());

            version.controls.scenes.Add(defaultScene);
            version.controlVersion = "2.0";
            version = await connection.MixPlay.UpdateMixPlayGameVersion(version);

            gameListings = await connection.MixPlay.GetOwnedMixPlayGames(channel);

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

            gameListing = gameListings.FirstOrDefault(gl => gl.id.Equals(game.id));
            Assert.IsNotNull(gameListing);

            return gameListing;
        }
        public void GetAvatar()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                string avatar = await connection.Users.GetAvatar(user);

                Assert.IsNotNull(avatar);
            });
        }
        public void GetTeams()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                IEnumerable <TeamMembershipExpandedModel> teams = await connection.Users.GetTeams(user);

                Assert.IsNotNull(teams);
            });
        }
        public void GetPreferences()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                UserPreferencesModel preferences = await connection.Users.GetPreferences(user);

                Assert.IsNotNull(preferences);
            });
        }
        public void GetSubscriptions()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                IEnumerable <SubscriptionWithGroupModel> subs = await connection.Users.GetSubscriptions(user, 1);

                Assert.IsNotNull(subs);
                Assert.IsTrue(subs.Count() > 0);
            });
        }
        public void GetFollows()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                IEnumerable <ChannelAdvancedModel> follows = await connection.Users.GetFollows(user, 1);

                Assert.IsNotNull(follows);
                Assert.IsTrue(follows.Count() > 0);
            });
        }
        public void GetUser()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                UserWithChannelModel channelUser = await connection.Users.GetUser(user);

                Assert.IsNotNull(channelUser);
                Assert.IsTrue(channelUser.id > (uint)0);
            });
        }
        public void GetNotifications()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                IEnumerable <NotificationModel> notifications = await connection.Users.GetNotifications(user, 1);

                Assert.IsNotNull(notifications);
                Assert.IsTrue(notifications.Count() > 0);
            });
        }
        public void GetLogs()
        {
            TestWrapper(async(MixerConnection connection) =>
            {
                UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection);

                IEnumerable <UserLogModel> logs = await connection.Users.GetLogs(user, 1);

                Assert.IsNotNull(logs);
                Assert.IsTrue(logs.Count() > 0);
            });
        }