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); }); }
public void GetChannelForUser() { TestWrapper(async(MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); }); }
public void CreateGetUpdateDeleteGame() { TestWrapper(async (MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); MixPlayGameListingModel gameListing = await MixPlayServiceUnitTests.CreateTestGame(connection, channel); IEnumerable<MixPlayGameListingModel> games = await connection.MixPlay.GetOwnedMixPlayGames(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"; MixPlayGameModel game = await connection.MixPlay.UpdateMixPlayGame(gameListing); Assert.IsNotNull(game); Assert.IsTrue(game.id > 0); Assert.AreEqual(game.name, gameName); await MixPlayServiceUnitTests.DeleteTestGame(connection, game); games = await connection.MixPlay.GetOwnedMixPlayGames(channel); Assert.IsNotNull(games); Assert.IsFalse(games.Any(g => g.id.Equals(game.id))); }); }
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 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 MixPlayServiceUnitTests.CreateTestGame(connection, channel); }); }
public static async Task <ChannelChatModel> GetChat(MixerConnection connection) { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); ChannelChatModel chat = await connection.Chats.GetChat(channel); Assert.IsNotNull(chat); Assert.IsTrue(chat.endpoints.Count() > 0); return(chat); }
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 GetEditorMixPlayGames() { TestWrapper(async (MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); IEnumerable<MixPlayGameListingModel> games = await connection.MixPlay.GetEditorMixPlayGames(channel); Assert.IsNotNull(games); }); }
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); }); }
public static async Task <UserModel> GetCurrentUser(MixerConnection connection) { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); PrivatePopulatedUserModel user = await connection.Users.GetCurrentUser(); Assert.IsNotNull(user); Assert.IsTrue(user.id > (uint)0); return(user); }
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 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 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); }); }
public static void ClassInitialize(TestContext context) { TestWrapper(async(MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); gameListing = await MixPlayServiceUnitTests.CreateTestGame(connection, channel); client = await MixPlayClient.CreateFromChannel(connection, channel, gameListing); Assert.IsTrue(await client.Connect()); Assert.IsTrue(await client.Ready()); }); }
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); }); }
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); }); }
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); }); }
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)); }); }
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 GetMixPlayVersion() { TestWrapper(async (MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); IEnumerable<MixPlayGameListingModel> games = await connection.MixPlay.GetOwnedMixPlayGames(channel); Assert.IsNotNull(games); Assert.IsTrue(games.Count() > 0); MixPlayGameVersionModel version = await connection.MixPlay.GetMixPlayGameVersion(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()); } }); }
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); }); }
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)); }); }
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); }); }
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); }); }
public void HostGetUnhostChannel() { TestWrapper(async(MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); ChannelModel hostChannel = await connection.Channels.GetChannel("MonsterCat"); channel = await connection.Channels.SetHostChannel(channel, hostChannel); Assert.IsNotNull(channel); ChannelModel hostedChannel = await connection.Channels.GetHostedChannel(channel); Assert.IsNotNull(hostedChannel); Assert.AreEqual(hostChannel.id, hostedChannel.id); bool result = await connection.Channels.UnhostChannel(channel); Assert.IsTrue(result); }); }
public void GetUsersWithRoles() { 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); users = await connection.Channels.GetUsersWithRoles(channel, "mod", 1); Assert.IsNotNull(users); Assert.IsTrue(users.Count() > 0); UserWithGroupsModel user = await connection.Channels.GetUser(channel, users.First().id); Assert.IsNotNull(user); Assert.IsTrue(user.id > 0); }); }
public void CheckIfFollows() { TestWrapper(async(MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); IEnumerable <UserWithChannelModel> followedUsers = await connection.Channels.GetFollowers(channel, 1); Assert.IsNotNull(followedUsers); Assert.IsTrue(followedUsers.Count() > 0); UserModel notFollowedUser = await connection.Users.GetUser("ChannelOne"); Assert.IsNotNull(notFollowedUser); Dictionary <uint, DateTimeOffset?> follows = await connection.Channels.CheckIfFollows(channel, new List <UserModel>() { followedUsers.First(), notFollowedUser }); Assert.IsNotNull(follows); Assert.IsTrue(follows.Count == 2); Assert.IsNotNull(follows[followedUsers.First().id]); Assert.IsNull(follows[notFollowedUser.id]); }); }
public void GetUsersProcessor() { TestWrapper(async(MixerConnection connection) => { ChannelModel channel = await ChannelsServiceUnitTests.GetChannel(connection); List <ChatUserModel> users = new List <ChatUserModel>(); await connection.Chats.GetUsers(channel, (results) => { foreach (ChatUserModel result in results) { users.Add(result); } return(Task.FromResult(0)); }); Assert.IsNotNull(users); if (users.Count() > 0) { ChatUserModel user = await connection.Chats.GetUser(channel, users.First().userId.GetValueOrDefault()); } }); }