本文整理汇总了C#中SemanticVersion.IsMonotonic方法的典型用法代码示例。如果您正苦于以下问题:C# SemanticVersion.IsMonotonic方法的具体用法?C# SemanticVersion.IsMonotonic怎么用?C# SemanticVersion.IsMonotonic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SemanticVersion
的用法示例。
在下文中一共展示了SemanticVersion.IsMonotonic方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsMonotonic_Invalid
public void IsMonotonic_Invalid()
{
// Has a non-zero patch component
var m0 = new SemanticVersion(2, 5, 1);
// Has pre-release identifier components
var m1 = new SemanticVersion(1, 0, 0, new[] { "abc" });
// Is null.
var m2 = (SemanticVersion)null;
Assert.IsFalse(m0.IsMonotonic());
Assert.IsFalse(m1.IsMonotonic());
new Action(() => m2.IsMonotonic())
.AssertThrows<ArgumentNullException>();
}
示例2: IsMonotonic_Valid
public void IsMonotonic_Valid()
{
// A semantic version is a valid monotonic version if it:
// a) Has a patch component of zero; and
// b) Has no pre-release identifiers.
//
// If either of these conditions is not fulfilled, a semantic
// version is not a valid monotonic version.
var m0 = new SemanticVersion(1, 2);
var m1 = new SemanticVersion(1, 0, 0, new string[0], new[] { "x" });
Assert.IsTrue(m0.IsMonotonic());
Assert.IsTrue(m1.IsMonotonic());
}