Пример #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;
        }
Пример #2
0
 public void SetUp()
 {
     _packageVersion = new PackageVersion(Version);
 }
Пример #3
0
 public void LessThanOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result =   priorVersionPackage < _packageVersion;
     Assert.IsTrue(result);
 }
Пример #4
0
 public void LessorEqualOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(EqualVersion);
     var result = priorVersionPackage <= _packageVersion;
     Assert.IsTrue(result);
 }
Пример #5
0
 public void GreaterThanOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result = _packageVersion > priorVersionPackage;
     Assert.IsTrue(result);
 }
Пример #6
0
 public void GreaterorEqualOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(EqualVersion);
     var result = _packageVersion >= priorVersionPackage;
     Assert.IsTrue(result);
 }
Пример #7
0
 public void DifferentOperatorTest()
 {
     var priorVersionPackage = new PackageVersion(PriorVersion);
     var result = _packageVersion != priorVersionPackage;
     Assert.IsTrue(result);
 }