Пример #1
0
        public static bool Test_COMPARELESS()
        {
            try
            {
                GitHubFunctions udp = new GitHubFunctions("thee7player", GitHubUpdater.LogTypeSettings.LogStatusOnly);
                Console.WriteLine("FETCH COUNT IS CURRENTLY: " + udp.getAPIFetchCount());
                //Target Repo with name
                Repo   target  = udp.GetRepository("CSGO-Event-Viewer");
                string Update1 = "0.3";
                string Update2 = "0.4.2"; //Same version as of 30/11/19
                string Update3 = "0.7";
                if (target is null)
                {
                    return(false);
                }
                //Project_APIURL <-

                bool a = ProductComparer.CompareVersionLess("thee7player", Update1, target);
                bool b = ProductComparer.CompareVersionLess("thee7player", Update2, target);
                bool c = ProductComparer.CompareVersionLess("thee7player", Update3, target);
                Console.WriteLine("FETCH COUNT AFTER !!!!!!!!!!!!!!!!! : " + udp.getAPIFetchCount());
                return(!a && b && c);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #2
0
        public static bool Test_GetRelease()
        {
            try
            {
                GitHubFunctions udp = new GitHubFunctions("TheE7Player", GitHubUpdater.LogTypeSettings.LogStatusOnly);

                /*Bypass the waiting process (FOR TESTING)
                 * Repo t = new Repo();
                 * t.setProject_Name("CSGO-Event-Viewer");
                 * t.setProject_Full_Name ( "TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_URL ( "https://github.com/TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_APIURL ( "https://api.github.com/repos/TheE7Player/CSGO-Event-Viewer");
                 * t.setProject_Description ("A Java project to allow users to see what events you can use with logic_eventlistener");
                 * t.setProject_Language ("Java");
                 * t.setProjects_Creation_Date ("2019-11-16T19:00:17Z");
                 * t.setProjects_Latest_Update_Date ("2019-11-30T16:23:40Z");
                 * t.setProjects_Latest_Push_Date ("2019-11-30T16:23:38Z"); */

                bool          findFiles = true;
                Release[]     r         = ProductComparer.GetUpdates(udp.GetRepository("CSGO-Event-Viewer"), findFiles, 2);
                List <Assets> _files    = null;
                Console.WriteLine(" -- INFORMATION FROM RELEASES -- ");

                if (r is null)
                {
                    return(false);
                }

                foreach (Release a in r)
                {
                    _files = a.Assets; //<- Get files from each release

                    Console.WriteLine($"Release: {a.Name}");
                    Console.WriteLine($"└─ Tag: {a.Tag }");
                    Console.WriteLine($"└─ Url: {a.URL}");
                    Console.WriteLine($"└─ Prerelease: {a.isPreRelease }");

                    Console.WriteLine("└─ Dates:");
                    Console.WriteLine($"     └─ Created Date (When drafted) : { a.Created}");
                    Console.WriteLine($"     └─ Published Date (When visible to public): { a.Published }");

                    Console.WriteLine($"└─ Downloadable files {_files.Count}: ");
                    foreach (Assets x in _files)
                    {
                        Console.WriteLine($"     └─ File { x.itemName } : { x.getItemSize(Assets.DisplaySize.Megabytes) } ({x.getItemSize(Assets.DisplaySize.Kilobytes) }) -> { x.itemDownloadUrl}");
                    }
                }
                Console.WriteLine(" -- INFORMATION FROM RELEASES -- ");

                return((findFiles) ? r != null && _files != null : r != null);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #3
0
        public static bool Test_COMPAREVERISON()
        {
            bool OutOfDate, SameVersion, HigherVersion;

            try
            {
                GitHubFunctions udp = new GitHubFunctions("thee7player", GitHubUpdater.LogTypeSettings.LogStatusOnly);

                //Target Repo with name
                Repo target = udp.GetRepository("CSGO-Event-Viewer");

                if (target is null)
                {
                    return(false);
                }

                string Update1 = "0.3";
                string Update2 = "0.4.2"; //Same version as of 10/12/19
                string Update3 = "0.7";

                OutOfDate     = ProductComparer.CompareVersionEqual("thee7player", Update1, target);
                SameVersion   = ProductComparer.CompareVersionEqual("thee7player", Update2, target);
                HigherVersion = ProductComparer.CompareVersionEqual("thee7player", Update3, target);

                /*EXPECTED Results:
                 | OutOfDate - Should return 'false' as 0.3 < 0.4.1
                 | SameVersion - Should return 'true' as 0.4.1 equals 0.4.1
                 | HigherVersion - should return 'false' as 0.7 > 0.4.1
                 */
                return(!OutOfDate && SameVersion && !HigherVersion);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #4
0
        public static bool Test_DirectSearch()
        {
            try
            {
                GitHubFunctions udp = new GitHubFunctions("repos/TheE7Player/CSGO-Event-Viewer", GitHubUpdater.LogTypeSettings.LogWithError, true);

                //Since DirectSearch targets one project, use .GetRepostiory(0);
                Repo Repos = udp.GetRepository(0);

                if (Repos != null) //Ensure it isn't null before fetching information
                {
                    string project_APILink    = Repos.Project_APIURL;
                    string project_Name       = Repos.Project_Name;
                    string project_LastUpdate = Repos.Projects_Latest_Update_Date; //Requires: import java.util.Date;

                    Console.WriteLine($"Repo Name: {project_Name}\r\nRepo API Link: {project_APILink}\r\nRepo Date (Updated): {project_LastUpdate}");
                }
                return(Repos != null);
            }
            catch (Exception)
            {
                return(false);
            }
        }