コード例 #1
0
        public void DeleteSocialMediaUsers_Test_Success()
        {
            string path = Path.Combine(Directory.GetCurrentDirectory(), "Test Files", GetType().Name, "Delete");

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            var users = new List <SocialMediaUserData>()
            {
                new SocialMediaUserData
                {
                    ChannelId   = 987654321, GuildId = 123456789, Id = "1", Name = "Test1",
                    SocialMedia = SocialMediaEnum.Twitter
                },
                new SocialMediaUserData
                {
                    ChannelId   = 123456789, GuildId = 987654321, Id = "2", Name = "Test2",
                    SocialMedia = SocialMediaEnum.Twitch
                }
            };
            var socialMedia = new SocialMedia(new Mock <DiscordSocketClient>().Object, new Mock <IConfiguration>().Object,
                                              users, new SocialMediaFileSystem(path));

            string result = socialMedia.DeleteSocialMediaUser(987654321, "Test2", SocialMediaEnum.Twitch);

            Assert.Equal("Successfully deleted Test2", result);

            Directory.Delete(Path.Combine(path));
        }
コード例 #2
0
        public virtual async Task DeleteAsync(string user)
        {
            ulong  guildId = Context.Guild.Id;
            string result  = SocialMedia.DeleteSocialMediaUser(guildId, user, SocialMediaType);

            await SendMessage(result);
        }
コード例 #3
0
        public void DeleteSocialMediaUsers_Test_Fail()
        {
            var result = _socialMedia.DeleteSocialMediaUser(123456789, "Fail", SocialMediaEnum.YouTube);

            Assert.Equal("Failed to delete Fail", result);
        }