Example #1
0
        public void SVersionLock_tests()
        {
            var b1LockMinor = new SVersionBound(V100, SVersionLock.LockMinor, PackageQuality.None);

            b1LockMinor.Satisfy(V100).Should().BeTrue("Same as the base version.");
            b1LockMinor.Satisfy(V101).Should().BeTrue("The patch can increase.");
            b1LockMinor.Satisfy(V110).Should().BeFalse("The minor is locked.");
            b1LockMinor.Satisfy(V200).Should().BeFalse("Major is of course also locked.");

            var b11 = new SVersionBound(V110, SVersionLock.LockMajor, PackageQuality.None);

            b11.Satisfy(V100).Should().BeFalse("Cannot downgrade minor.");
            b11.Satisfy(V110).Should().BeTrue();
            b11.Satisfy(V111).Should().BeTrue();
            b11.Satisfy(V200).Should().BeFalse("Cannot upgrade major.");

            var b1LockMajor = b1LockMinor.SetLock(SVersionLock.LockMajor);

            b1LockMajor.Contains(b1LockMinor).Should().BeTrue();
            b1LockMajor.Contains(b11).Should().BeTrue("Same major is locked.");

            var b2 = new SVersionBound(V200, SVersionLock.Lock, PackageQuality.None);

            b1LockMinor.Contains(b2).Should().BeFalse();
            b1LockMajor.Contains(b2).Should().BeFalse();
        }
Example #2
0
        public void union_with_lock_and_MinQuality()
        {
            var b10 = new SVersionBound(V100, SVersionLock.LockMinor, PackageQuality.None);
            var b11 = new SVersionBound(V110, SVersionLock.LockMajor, PackageQuality.Stable);

            b10.Contains(b11).Should().BeFalse("The 1.0 minor is locked.");
            b11.Contains(b10).Should().BeFalse("The 1.1 base version is greater than the 1.0 base version.");

            var u = b10.Union(b11);

            u.Should().Be(b11.Union(b10));

            u.Base.Should().Be(SVersion.Create(1, 0, 0));
            u.Lock.Should().Be(SVersionLock.LockMajor);
            u.MinQuality.Should().Be(PackageQuality.CI);

            var b21 = new SVersionBound(V210, SVersionLock.LockMajor, PackageQuality.Exploratory);

            var u2 = b21.Union(b11);

            u2.Should().Be(b11.Union(b21));

            u2.Base.Should().Be(SVersion.Create(1, 1, 0));
            u2.Lock.Should().Be(SVersionLock.LockMajor);
            u2.MinQuality.Should().Be(PackageQuality.Exploratory);
        }
Example #3
0
        public void partial_ordering_only()
        {
            var b1  = new SVersionBound(V100, SVersionLock.None, PackageQuality.Preview);
            var b11 = new SVersionBound(V110, SVersionLock.None, PackageQuality.None);

            b1.Contains(b11).Should().BeFalse("b1 only accepts preview and b11 accepts everything.");
            b11.Contains(b1).Should().BeFalse("b11.Base version is greater than b1.Base version.");

            var u = b1.Union(b11);

            b11.Union(b1).Should().Be(u);

            u.Contains(b1).Should().BeTrue();
            u.Contains(b11).Should().BeTrue();

            var i = b1.Intersect(b11);

            b11.Intersect(b1).Should().Be(i);
            i.Contains(b1).Should().BeFalse();
            i.Contains(b11).Should().BeFalse();
        }
Example #4
0
        public void basic_union_operations()
        {
            SVersionBound.None.Union(SVersionBound.None).Should().Be(SVersionBound.None);
            SVersionBound.None.Union(SVersionBound.All).Should().Be(SVersionBound.All);
            SVersionBound.All.Union(SVersionBound.None).Should().Be(SVersionBound.All);

            var b1 = new SVersionBound(CSVersion.VeryFirstVersion, SVersionLock.None, PackageQuality.None);
            var b2 = new SVersionBound(CSVersion.VeryLastVersion, SVersionLock.None, PackageQuality.None);

            SVersionBound.None.Union(b1).Should().Be(b1);
            b1.Union(SVersionBound.None).Should().Be(b1);

            SVersionBound.None.Union(b2).Should().Be(b2);
            b2.Union(SVersionBound.None).Should().Be(b2);

            b1.Contains(b2).Should().BeTrue("VeryFirstVersion bound contains VeryLastVersion bound.");
            b2.Contains(b1).Should().BeFalse("VeryLastVersion bound doen't contain VeryFirstVersion.");

            b1.Union(b2).Should().Be(b1);
            b2.Union(b1).Should().Be(b1);
        }