コード例 #1
0
        public void basic_intersect_operations()
        {
            SVersionBound.None.Intersect(SVersionBound.None).Should().Be(SVersionBound.None);
            SVersionBound.None.Intersect(SVersionBound.All).Should().Be(SVersionBound.None);
            SVersionBound.All.Intersect(SVersionBound.None).Should().Be(SVersionBound.None);

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

            b1.Intersect(b1).Should().Be(b1);
            SVersionBound.None.Intersect(b1).Should().Be(SVersionBound.None);
            b1.Intersect(SVersionBound.None).Should().Be(SVersionBound.None);
            b1.Intersect(SVersionBound.All).Should().Be(b1);
            SVersionBound.All.Intersect(b1).Should().Be(b1);

            b2.Intersect(b2).Should().Be(b2);
            SVersionBound.None.Intersect(b2).Should().Be(SVersionBound.None);
            b2.Intersect(SVersionBound.None).Should().Be(SVersionBound.None);
            b2.Intersect(SVersionBound.All).Should().Be(b2);
            SVersionBound.All.Intersect(b2).Should().Be(b2);

            b1.Intersect(b2).Should().Be(b2);
            b2.Intersect(b1).Should().Be(b2);
        }
コード例 #2
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();
        }