Example #1
0
        public KspVersionBound(KspVersion value, bool inclusive)
        {
            if (ReferenceEquals(value, null))
                throw new ArgumentNullException("value");

            if (!value.IsAny && !value.IsFullyDefined)
                throw new ArgumentException("Version must be either fully undefined or fully defined.", "value");

            Value = value;
            Inclusive = inclusive;

            // Workaround an issue in old (<=3.2.x) versions of Mono that does not correctly handle null values
            // returned from ToString().
            var valueStr = value.ToString() ?? string.Empty;

            _string = inclusive ? string.Format("[{0}]", valueStr) : string.Format("({0})", valueStr);
        }
Example #2
0
        public KspVersionBound(KspVersion value, bool inclusive)
        {
            if (ReferenceEquals(value, null))
            {
                throw new ArgumentNullException("value");
            }

            if (!value.IsAny && !value.IsFullyDefined)
            {
                throw new ArgumentException("Version must be either fully undefined or fully defined.", "value");
            }

            Value     = value;
            Inclusive = inclusive;

            // Workaround an issue in old (<=3.2.x) versions of Mono that does not correctly handle null values
            // returned from ToString().
            var valueStr = value.ToString() ?? string.Empty;

            _string = inclusive ? string.Format("[{0}]", valueStr) : string.Format("({0})", valueStr);
        }
Example #3
0
 private static string SameVersionString(KspVersion v)
 {
     return(v.IsAny ? "all versions" : v.ToString());
 }
Example #4
0
        public void QuadrupleParameterCtorWorksCorrectly()
        {
            // Act
            var result = new KspVersion(1, 2, 3, 4);

            // Assert
            Assert.AreEqual(1, result.Major);
            Assert.AreEqual(2, result.Minor);
            Assert.AreEqual(3, result.Patch);
            Assert.AreEqual(4, result.Build);

            Assert.IsTrue(result.IsMajorDefined);
            Assert.IsTrue(result.IsMinorDefined);
            Assert.IsTrue(result.IsPatchDefined);
            Assert.IsTrue(result.IsBuildDefined);

            Assert.IsTrue(result.IsFullyDefined);
            Assert.IsFalse(result.IsAny);

            Assert.AreEqual("1.2.3.4", result.ToString());
        }
Example #5
0
        public void SingleParameterCtorWorksCorrectly()
        {
            // Act
            var result = new KspVersion(1);

            // Assert
            Assert.AreEqual(1, result.Major);
            Assert.AreEqual(-1, result.Minor);
            Assert.AreEqual(-1, result.Patch);
            Assert.AreEqual(-1, result.Build);

            Assert.IsTrue(result.IsMajorDefined);
            Assert.IsFalse(result.IsMinorDefined);
            Assert.IsFalse(result.IsPatchDefined);
            Assert.IsFalse(result.IsBuildDefined);

            Assert.IsFalse(result.IsFullyDefined);
            Assert.IsFalse(result.IsAny);

            Assert.AreEqual("1", result.ToString());
        }