Exemplo n.º 1
0
            /// <summary>
            ///     Greater than 0 newer
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public int Compare(string?x, string?y)
            {
                var xResult = SuffixVersion.TryParse(x, out var version1) ? 1 : 0;
                var yResult = SuffixVersion.TryParse(y, out var version2) ? 1 : 0;

                var parseResult = xResult - yResult;

                if (parseResult != 0)
                {
                    return(parseResult);
                }

                return(version1.CompareTo(version2));
            }
Exemplo n.º 2
0
        public void Test()
        {
            var rel = SuffixVersion.Parse("1.0.0");
            var a1  = SuffixVersion.Parse("1.0.0-Alpha1");
            var a3  = SuffixVersion.Parse("1.0.0-aLpHa3");
            var b2  = SuffixVersion.Parse("1.0.0-betA2");

            Assert.AreEqual(rel.ToString(), "1.0.0");
            Assert.AreEqual(a1.ToString(), "1.0.0-Alpha1");
            Assert.IsTrue(rel.CompareTo(a1) > 0);
            Assert.IsTrue(rel.CompareTo(b2) > 0);

            Assert.IsTrue(b2.CompareTo(a1) > 0);
            Assert.IsTrue(b2.CompareTo(a3) > 0);
        }