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


C# SemanticVersion.Last方法代码示例

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


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

示例1: Create_Chronology_Valid_Complex

        public void Create_Chronology_Valid_Complex()
        {
            var ch = new SemanticVersion[]
            {
                /* 0 */ new SemanticVersion(1, 0),
                /* 1 */ new SemanticVersion(1, 1),
                /* 2 */ new SemanticVersion(2, 2), // Latest, line 2
                /* 3 */ new SemanticVersion(1, 3),
                /* 4 */ new SemanticVersion(3, 4),
                /* 5 */ new SemanticVersion(3, 5), // Latest, line 3
                /* 6 */ new SemanticVersion(1, 6), // Latest, line 1 & overall
            };
            var mv = new MonotonicVersioner(ch);

            // [Compatibility] provides the greatest-value component
            // yet generated by the class, not the latest component.
            Assert.AreEqual(3, mv.Compatibility);
            // [Release] is not related to [Compatibility], and provides
            // the current release number.
            Assert.AreEqual(6, mv.Release);

            // [Latest] should provide the chronologically-latest version,
            // regardless of the line of compatibility.
            Assert.AreEqual(ch.Last(), mv.Latest);

            // [LatestVersions] should, as the name might imply, provide
            // the latest version in each line of compatibility.
            Assert.AreEqual(ch[6], mv.LatestVersions[1]);
            Assert.AreEqual(ch[2], mv.LatestVersions[2]);
            Assert.AreEqual(ch[5], mv.LatestVersions[3]);
            // Make sure these are the only keys in the collection.
            Assert.AreEqual(3, mv.LatestVersions.Keys.Count());

            // The chronology must be in order.
            Assert.IsTrue(mv.Chronology.SequenceEqual(ch));
        }
开发者ID:McSherry,项目名称:McSherry.SemanticVersioning,代码行数:36,代码来源:MonotonicVersionerTests.cs

示例2: Create_Chronology_Valid_StartsAtZero

        public void Create_Chronology_Valid_StartsAtZero()
        {
            var ch = new SemanticVersion[]
            {
                new SemanticVersion(0, 0),
                new SemanticVersion(0, 1),
                new SemanticVersion(1, 2),
                new SemanticVersion(2, 3),
            };
            var mv = new MonotonicVersioner(ch);

            Assert.AreEqual(2, mv.Compatibility);
            Assert.AreEqual(3, mv.Release);

            Assert.AreEqual(ch.Last(), mv.Latest);

            Assert.AreEqual(ch[1], mv.LatestVersions[0]);
            Assert.AreEqual(ch[2], mv.LatestVersions[1]);
            Assert.AreEqual(ch[3], mv.LatestVersions[2]);

            Assert.AreEqual(3, mv.LatestVersions.Keys.Count());

            Assert.IsTrue(mv.Chronology.SequenceEqual(ch));
        }
开发者ID:McSherry,项目名称:McSherry.SemanticVersioning,代码行数:24,代码来源:MonotonicVersionerTests.cs

示例3: Create_Chronology_Valid_Basic

        public void Create_Chronology_Valid_Basic()
        {
            // Does it work at all?
            var ch = new SemanticVersion[]
            {
                new SemanticVersion(1, 0),
                new SemanticVersion(1, 1),
                new SemanticVersion(1, 2),
            };
            var mv = new MonotonicVersioner(ch);

            Assert.AreEqual(1, mv.Compatibility);
            Assert.AreEqual(2, mv.Release);

            Assert.AreEqual(new SemanticVersion(1, 2), mv.Latest);

            Assert.AreEqual(ch.Last(), mv.LatestVersions[1]);

            Assert.IsTrue(mv.Chronology.SequenceEqual(ch));
        }
开发者ID:McSherry,项目名称:McSherry.SemanticVersioning,代码行数:20,代码来源:MonotonicVersionerTests.cs


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