Пример #1
0
        public void ReferenceEqualsRightNull()
        {
            SemanticVersion version = new SemanticVersion(1, 0, 0);

            VersionComparer comparer = new VersionComparer();

            Assert.False(comparer.Equals(version, null));
        }
Пример #2
0
        public void ReferenceEqualsSameObject()
        {
            SemanticVersion version = new SemanticVersion(1, 0, 0);

            VersionComparer comparer = new VersionComparer();

            Assert.True(comparer.Equals(version, version));
        }
        public void ReferenceEqualsRightNull()
        {
            SemanticVersion version = new SemanticVersion(1, 0, 0);

            VersionComparer comparer = new VersionComparer();

            Assert.False(comparer.Equals(version, null));
        }
        public void ReferenceEquals()
        {
            SemanticVersion version = new SemanticVersion(1, 0, 0);

            VersionComparer comparer = new VersionComparer();

            Assert.True(comparer.Equals(version, version));
        }
Пример #5
0
        private static bool EqualsOneWay(VersionComparer comparer, string version1, string version2)
        {
            // Arrange
            var     a = Version.Parse(version1);
            var     b = Version.Parse(version2);
            Version c = Version.Parse(version1);
            Version d = Version.Parse(version2);

            // Act
            var match = Compare(comparer, version1, version2) == 0;

            match &= comparer.Equals(a, b);
            match &= comparer.Equals(a, d);
            match &= comparer.Equals(c, d);
            match &= comparer.Equals(c, b);

            return(match);
        }
Пример #6
0
        private bool PackageIdentityEquals(PackageIdentity x, PackageIdentity y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }

            if (ReferenceEquals(x, null) ||
                ReferenceEquals(y, null))
            {
                return(false);
            }

            var versionComparer = new VersionComparer(VersionComparison.Default);

            return(versionComparer.Equals(x.Version, y.Version) &&
                   StringComparer.OrdinalIgnoreCase.Equals(x.Id, y.Id));
        }