Example #1
0
        public int CompareTo(PackageVersion o)
        {
            var pv = o as PackageVersion;
            if (pv == null) return -1;

            var result = 0;
            if (pv._parts.Length > _parts.Length)
                return -pv.CompareTo(this);

            for (var i = 0; i < _parts.Length; i++)
            {
                if (pv._parts.Length < i + 1)
                {
                    result = Compare(_parts[i], "0");
                }
                else
                {
                    result = Compare(_parts[i], pv._parts[i]);
                }
                if (result != 0)
                    return result;
            }
            return result;
        }
Example #2
0
 public void SetUp()
 {
     _packageVersion = new PackageVersion(Version);
 }
Example #3
0
 public void LessThanOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result =   priorVersionPackage < _packageVersion;
     Assert.IsTrue(result);
 }
Example #4
0
 public void LessorEqualOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(EqualVersion);
     var result = priorVersionPackage <= _packageVersion;
     Assert.IsTrue(result);
 }
Example #5
0
 public void GreaterThanOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result = _packageVersion > priorVersionPackage;
     Assert.IsTrue(result);
 }
Example #6
0
 public void GreaterorEqualOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(EqualVersion);
     var result = _packageVersion >= priorVersionPackage;
     Assert.IsTrue(result);
 }
Example #7
0
 public void DifferentOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result = _packageVersion != priorVersionPackage;
     Assert.IsTrue(result);
 }