コード例 #1
0
        public void CanSatisfyLessThanOrEqual()
        {
            BinaryExpression e = SemanticVersion.GetBinaryExpression(ExpressionType.LessThanOrEqual, v1, v1);

            Assert.NotNull(e);
            Assert.True(SemanticVersion.InvokeBinaryExpression(e));
            BinaryExpression e2 = SemanticVersion.GetBinaryExpression(ExpressionType.LessThanOrEqual, v090a1, v090);

            Assert.True(SemanticVersion.InvokeBinaryExpression(e2));
            e2 = SemanticVersion.GetBinaryExpression(ExpressionType.LessThanOrEqual, v000a1, v010a1);
            Assert.False(SemanticVersion.InvokeBinaryExpression(e2)); //should compare on prerelease
            e2 = SemanticVersion.GetBinaryExpression(ExpressionType.LessThanOrEqual, v000a0, v000a1);
            Assert.True(SemanticVersion.InvokeBinaryExpression(e2));
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThanOrEqual, v090, v186)));
        }
コード例 #2
0
        public void CanSatisfyLessThan()
        {
            BinaryExpression e = SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v1, v2);

            Assert.NotNull(e);
            BinaryExpression e2 = SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v000a2, v090a1);

            e2 = SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v000a1, v010a1);
            Assert.False(SemanticVersion.InvokeBinaryExpression(e2)); //Compare only on pre-release
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v202a, v202)));
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v090a1, v090b2)));
            Assert.False(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v000a1, v000a0)));
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v090b1, v090b2)));
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v090a1, v090b2)));
            Assert.True(SemanticVersion.InvokeBinaryExpression(SemanticVersion.GetBinaryExpression(ExpressionType.LessThan, v090a2, v090b1)));
        }