public void ReferenceEqualsRightNull() { SemanticVersion version = new SemanticVersion(1, 0, 0); VersionComparer comparer = new VersionComparer(); Assert.False(comparer.Equals(version, null)); }
public void ReferenceEqualsSameObject() { SemanticVersion version = new SemanticVersion(1, 0, 0); VersionComparer comparer = new VersionComparer(); Assert.True(comparer.Equals(version, version)); }
public void ReferenceEquals() { SemanticVersion version = new SemanticVersion(1, 0, 0); VersionComparer comparer = new VersionComparer(); Assert.True(comparer.Equals(version, version)); }
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); }
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)); }