Esempio n. 1
0
        [InlineData("https://pastebin.com/0x7jJvB4", "Untitled", (int)Species.Miltank, (int)Species.Braviary)] // Miltank...Braviary
        public static void HasPastebinSets(string url, string name, params int[] speciesPresent)
        {
            var tpi = new TeamPasteInfo(url);

            tpi.Source.Should().Be(TeamPasteInfo.PasteSource.Pastebin);
            tpi.VerifyContents(name, speciesPresent);
        }
Esempio n. 2
0
        private static void URLGen(object sender, EventArgs e)
        {
            var           url = Clipboard.GetText().Trim();
            TeamPasteInfo info;

            try
            {
                info = new TeamPasteInfo(url);
            }
            catch (Exception ex)
            {
                WinFormsUtil.Error("An error occured while trying to obtain the contents of the URL.", $"The exact error is as follows: {ex}");
                return;
            }
            if (!info.Valid)
            {
                WinFormsUtil.Error("The data inside the URL are not valid Showdown Sets");
                return;
            }
            if (info.Source == TeamPasteInfo.PasteSource.None)
            {
                WinFormsUtil.Error("The URL provided is not from a supported website.");
                return;
            }

            ShowdownSetLoader.Import(info.Sets);

            var response = $"All sets genned from the following URL: {info.URL}";

            WinFormsUtil.Alert(response, info.Summary);
        }
Esempio n. 3
0
        private static void VerifyContents(this TeamPasteInfo tpi, string name, int[] speciesPresent)
        {
            tpi.Valid.Should().BeTrue("Data should exist for this paste");
            tpi.Title.Should().Be(name, "Data should have a title present");

            var team    = ShowdownUtil.ShowdownSets(tpi.Sets);
            var species = team.ConvertAll(s => s.Species);
            var hasAll  = speciesPresent.All(species.Contains);

            hasAll.Should().BeTrue("Specific species are expected");
        }