当前位置: 首页>>代码示例>>C#>>正文


C# SemanticVersion.Equals方法代码示例

本文整理汇总了C#中SemanticVersion.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.Equals方法的具体用法?C# SemanticVersion.Equals怎么用?C# SemanticVersion.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SemanticVersion的用法示例。


在下文中一共展示了SemanticVersion.Equals方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Equality

    public void Equality()
    {
        var sv12a = new SemanticVersion(new Version(1, 2), null);
        var sv12b = new SemanticVersion(new Version(1, 2), null);
        Assert.Equal(sv12a, sv12b);

        var sv13 = new SemanticVersion(new Version(1, 3), null);
        Assert.NotEqual(sv12a, sv13);

        var sv12Pre = new SemanticVersion(new Version(1, 2), "-pre");
        var sv12Beta = new SemanticVersion(new Version(1, 2), "-beta");
        Assert.NotEqual(sv12a, sv12Pre);
        Assert.NotEqual(sv12Pre, sv12Beta);
        Assert.Equal(sv12Pre, sv12Pre);

        Assert.False(sv12a.Equals(null));
    }
开发者ID:jkeech,项目名称:Nerdbank.GitVersioning,代码行数:17,代码来源:SemanticVersionTests.cs

示例2: Equality

    public void Equality()
    {
        var sv12a = new SemanticVersion(new Version(1, 2), null);
        var sv12b = new SemanticVersion(new Version(1, 2), null);
        Assert.Equal(sv12a, sv12b);

        var sv13 = new SemanticVersion(new Version(1, 3), null);
        Assert.NotEqual(sv12a, sv13);

        var sv12Pre = new SemanticVersion(new Version(1, 2), "-pre");
        var sv12Beta = new SemanticVersion(new Version(1, 2), "-beta");
        Assert.NotEqual(sv12a, sv12Pre);
        Assert.NotEqual(sv12Pre, sv12Beta);
        Assert.Equal(sv12Pre, sv12Pre);

        var sv12BuildInfo = new SemanticVersion(new Version(1, 2), buildMetadata: "+buildInfo");
        var sv12OtherBuildInfo = new SemanticVersion(new Version(1, 2), buildMetadata: "+otherBuildInfo");
        Assert.NotEqual(sv12BuildInfo, sv12OtherBuildInfo);
        Assert.Equal(sv12BuildInfo, sv12BuildInfo);

        Assert.False(sv12a.Equals(null));
    }
开发者ID:jthelin,项目名称:Nerdbank.GitVersioning,代码行数:22,代码来源:SemanticVersionTests.cs

示例3: SemVerEqualsOperatorWorks

        public void SemVerEqualsOperatorWorks(string versionA, string versionB)
        {
            // Arrange
            var itemA = new SemanticVersion(versionA);
            var itemB = new SemanticVersion(versionB);
            object objectB = itemB;

            // Act and Assert
            Assert.True(itemA == itemB);
            Assert.True(itemA.Equals(itemB));
            Assert.True(itemA.Equals(objectB));
            Assert.True(itemA <= itemB);
            Assert.True(itemB == itemA);
            Assert.True(itemB >= itemA);
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:15,代码来源:SemanticVersionTest.cs

示例4: EqualsReturnsFalseIfComparingANonSemVerType

        public void EqualsReturnsFalseIfComparingANonSemVerType(object other)
        {
            // Arrange
            var semVer = new SemanticVersion("1.0.0");

            // Act and Assert
            Assert.False(semVer.Equals(other));
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:8,代码来源:SemanticVersionTest.cs

示例5: SemVerLessThanAndGreaterThanOperatorsWorks

        public void SemVerLessThanAndGreaterThanOperatorsWorks(string versionA, string versionB)
        {
            // Arrange
            var itemA = new SemanticVersion(versionA);
            var itemB = new SemanticVersion(versionB);
            object objectB = itemB;

            // Act and Assert
            Assert.True(itemA < itemB);
            Assert.True(itemA <= itemB);
            Assert.True(itemB > itemA);
            Assert.True(itemB >= itemA);
            Assert.False(itemA.Equals(itemB));
            Assert.False(itemA.Equals(objectB));
        }
开发者ID:Newtopian,项目名称:nuget,代码行数:15,代码来源:SemanticVersionTest.cs

示例6: EqualsWhereNot

        public void EqualsWhereNot()
        {
            // Setup
            var version1 = new SemanticVersion("1.0.0-alpha");
            var version2 = new SemanticVersion(4, 15, 26, "beta6");

            // Execute
            var result = version1.Equals(version2);

            // Assert
            Assert.IsFalse(result);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:12,代码来源:SemanticVersionTest.cs

示例7: Equals

        public void Equals()
        {
            // Setup
            var version1 = new SemanticVersion("4.15.26-beta6");
            var version2 = new SemanticVersion(4, 15, 26, "beta6");

            // Execute
            var result = version1.Equals(version2);

            // Assert
            Assert.IsTrue(result);
        }
开发者ID:jsmunroe,项目名称:Helpers,代码行数:12,代码来源:SemanticVersionTest.cs

示例8: FindPackage

        IPackage FindPackage(int attempt, string packageId, string packageVersion, string feed, out NuGet.PackageDownloader downloader)
        {
            Log.VerboseFormat("Finding package (attempt {0} of {1})", attempt, NumberOfTimesToAttemptToDownloadPackage);

            var remoteRepository = packageRepositoryFactory.CreateRepository(feed);

            var dspr = remoteRepository as DataServicePackageRepository;
            downloader = dspr != null ? dspr.PackageDownloader : null;

            var requiredVersion = new SemanticVersion(packageVersion);
            var package = remoteRepository.FindPackage(packageId, requiredVersion, true, true);

            if (package == null)
                throw new Exception(string.Format("Could not find package {0} {1} in feed: '{2}'", packageId, packageVersion, feed));

            if (!requiredVersion.Equals(package.Version))
            {
                var message = string.Format("The package version '{0}' returned from the package repository doesn't match the requested package version '{1}'.", package.Version, requiredVersion);
                throw new Exception(message);
            }

            return package;
        }
开发者ID:sergio,项目名称:Calamari,代码行数:23,代码来源:PackageDownloader.cs

示例9: SemVerArentEqualToNull

        public void SemVerArentEqualToNull(SemanticVersion semVer)
        {
            const bool expected = false;

            var actual = semVer.Equals(null);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:8,代码来源:SemanticVersionComparerTests.cs

示例10: SemVerEqualsItself

        public void SemVerEqualsItself(SemanticVersion semVer)
        {
            const bool expected = true;

            var actual = semVer.Equals(semVer);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:8,代码来源:SemanticVersionComparerTests.cs

示例11: SemVerArentEqualToStringEmpty

        public void SemVerArentEqualToStringEmpty(SemanticVersion semVer)
        {
            const bool expected = false;

            var actual = semVer.Equals(string.Empty);

            Assert.Equal(expected, actual);
        }
开发者ID:cyberzed,项目名称:SemanticVersioning,代码行数:8,代码来源:SemanticVersionComparerTests.cs

示例12: OverridedEqualsTest

        public void OverridedEqualsTest()
        {
            SemanticVersion o = null;
            SemanticVersion v = new SemanticVersion(4, 2, 1);

            Assert.False(v.Equals(o));
            Assert.False(v.Equals(new PreRelease(PreReleaseStage.ALPHA)));

            o = v;
            Assert.True(v.Equals(o));

            o = new SemanticVersion(4, 2, 1);
            Assert.True(v.Equals(o));
        }
开发者ID:z2xlong,项目名称:SemanticVersion,代码行数:14,代码来源:CompareTest.cs


注:本文中的SemanticVersion.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。