コード例 #1
0
ファイル: Program.cs プロジェクト: TheE7Player/GitHubUpdater
        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);
            }
        }