コード例 #1
0
        public void should_be_equal_when_both_real_and_version_match()
        {
            var first  = new Revision();
            var second = new Revision();

            first.CompareTo(second).Should().Be(0);
        }
コード例 #2
0
        public void should_be_equal_when_both_real_and_version_match_for_real()
        {
            var first = new Revision(real: 1);
            var second = new Revision(real: 1);

            first.CompareTo(second).Should().Be(0);
        }
コード例 #3
0
        public void should_be_equal_when_both_real_and_version_match_for_real_proper()
        {
            var first  = new Revision(version: 2, real: 1);
            var second = new Revision(version: 2, real: 1);

            first.CompareTo(second).Should().Be(0);
        }
コード例 #4
0
        public int CompareTo(ModuleVersion other)
        {
            var comparison = MajorVersion.CompareTo(other.MajorVersion);

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

            comparison = MinorVersion.CompareTo(other.MinorVersion);

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

            comparison = Revision.CompareTo(other.Revision);

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

            if (IsPreRelease && !other.IsPreRelease)
            {
                return(-1);
            }

            if (other.IsPreRelease && !IsPreRelease)
            {
                return(1);
            }

            return(0);
        }
コード例 #5
0
ファイル: Versioning.cs プロジェクト: awzhome/taskington
    public int CompareTo(BuildVersion other)
    {
        if ((Revision == 0) && (other.Revision == 0))
        {
            if (!IsDevMark && other.IsDevMark)
            {
                return(-1);
            }
            else if (IsDevMark && !other.IsDevMark)
            {
                return(1);
            }
        }

        int majorCompare = Major.CompareTo(other.Major);

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

        int minorCompare = Minor.CompareTo(other.Minor);

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

        int patchCompare = Patch.CompareTo(other.Patch);

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

        int revisionCompare = Revision.CompareTo(other.Revision);

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

        string normTag      = Tag ?? string.Empty;
        string normOtherTag = other.Tag ?? string.Empty;

        if (normTag != normOtherTag)
        {
            return(normTag.CompareTo(normOtherTag));
        }

        return(0);
    }
コード例 #6
0
        /// <inheritdoc/>
        public int CompareTo([AllowNull] HeroesDataVersion other)
        {
            if (other is null)
            {
                return(1);
            }

            int valueCompare = Major.CompareTo(other.Major);

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

            valueCompare = Minor.CompareTo(other.Minor);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            valueCompare = Revision.CompareTo(other.Revision);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            valueCompare = Build.CompareTo(other.Build);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            if (IsPtr == other.IsPtr)
            {
                return(0);
            }
            else if (other.IsPtr)
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        }
コード例 #7
0
        /// <inheritdoc/>
        public int CompareTo(VersionData other)
        {
            if (Major != other.Major)
            {
                return(Major.CompareTo(other.Major));
            }

            if (Minor != other.Minor)
            {
                return(Minor.CompareTo(other.Minor));
            }

            if (Revision != other.Revision)
            {
                return(Revision.CompareTo(other.Revision));
            }

            return(Patch.CompareTo(other.Patch));
        }
コード例 #8
0
        /// <inheritdoc/>
        public int CompareTo([AllowNull] StormReplayVersion other)
        {
            if (other is null)
            {
                return(1);
            }

            int valueCompare = BaseBuild.CompareTo(other.BaseBuild);

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

            valueCompare = Build.CompareTo(other.Build);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            valueCompare = Revision.CompareTo(other.Revision);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            valueCompare = Minor.CompareTo(other.Minor);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            valueCompare = Major.CompareTo(other.Major);
            if (valueCompare != 0)
            {
                return(valueCompare);
            }

            return(0);
        }
コード例 #9
0
 public int CompareTo(BandLevelComponent other)
 {
     if (other == null)
     {
         return(1);
     }
     if (Major != other.Major)
     {
         return(Major.CompareTo(other.Major));
     }
     if (Minor != other.Minor)
     {
         return(Minor.CompareTo(other.Minor));
     }
     if (Revision != other.Revision)
     {
         return(Revision.CompareTo(other.Revision));
     }
     return(RomanNumeral != other.RomanNumeral
             ? RomanToInteger(RomanNumeral).CompareTo(RomanToInteger(other.RomanNumeral))
             : 0);
 }
コード例 #10
0
        public int CompareTo(UnityVersion other)
        {
            var result = Major.CompareTo(other.Major);

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

            result = Minor.CompareTo(other.Minor);
            if (result != 0)
            {
                return(result);
            }

            result = Revision.CompareTo(other.Revision);
            if (result != 0)
            {
                return(result);
            }

            result = CompareReleaseType(ReleaseType, other.ReleaseType);
            if (result != 0)
            {
                return(result);
            }

            result = IncrementalVersion.CompareTo(other.IncrementalVersion);
            if (result != 0)
            {
                return(result);
            }

            // We do not compare the Suffix

            return(0);
        }
コード例 #11
0
 public override int CompareRevisions(Library library)
 {
     // Not a valid request, if the two libraries are not the same.
     Debug.Assert(IsSameLibrary(library));
     return(Revision.CompareTo(((MidasLibrary)library).Revision));
 }