public void ResrictToMinimalRequirement()
            {
                MinimalVersionRequirement minimalRequirement;
                IVersionRequirement       targetRequirement;

                // When greater (4.0+)
                minimalRequirement = new MinimalVersionRequirement("4.0");
                Assert.Throws <IncompatibleRequirementException>(
                    delegate
                {
                    requirement.RestrictTo(minimalRequirement);
                }
                    );

                // When in between (2.0+)
                minimalRequirement = new MinimalVersionRequirement("2.0");
                targetRequirement  = new RangeVersionRequirement("2.0", "3.5");
                Assert.AreEqual(requirement.RestrictTo(minimalRequirement), targetRequirement);

                // When lesser (0.9+)
                minimalRequirement = new MinimalVersionRequirement("0.9");
                Assert.AreSame(requirement.RestrictTo(minimalRequirement), requirement);
            }
            public void RestrictToLoseRequirement()
            {
                LoseVersionRequirement loseRequirement;

                // When greater (1.1)
                loseRequirement = new LoseVersionRequirement("1.1");
                Assert.AreSame(requirement.RestrictTo(loseRequirement), loseRequirement);

                // When less detailed (1)
                loseRequirement = new LoseVersionRequirement("1");
                IVersionRequirement targetRequirement = new RangeVersionRequirement("1.0", "2");

                Assert.AreEqual(requirement.RestrictTo(loseRequirement), targetRequirement);

                // When lesser (0.9)
                loseRequirement = new LoseVersionRequirement("0.9");
                Assert.Throws <IncompatibleRequirementException>(
                    delegate
                {
                    requirement.RestrictTo(loseRequirement);
                }
                    );
            }
            public void RestrictToBoundedRequirement()
            {
                BoundedVersionRequirement loseRequirement;
                IVersionRequirement       targetRequirement;

                // When greater (4.0.*)
                loseRequirement = new BoundedVersionRequirement("4.0");
                Assert.Throws <IncompatibleRequirementException>(
                    delegate
                {
                    requirement.RestrictTo(loseRequirement);
                }
                    );

                // When in between (2.0.*)
                loseRequirement = new BoundedVersionRequirement("2.0");
                Assert.AreEqual(requirement.RestrictTo(loseRequirement), loseRequirement);

                // When lesser (0.9.*)
                loseRequirement = new BoundedVersionRequirement("0.9");
                Assert.Throws <IncompatibleRequirementException>(
                    delegate
                {
                    requirement.RestrictTo(loseRequirement);
                }
                    );

                // When overlapping bottom
                loseRequirement   = new BoundedVersionRequirement("1");
                targetRequirement = new RangeVersionRequirement("1.5", "2");
                Assert.AreEqual(requirement.RestrictTo(loseRequirement), targetRequirement);

                // When overlapping top
                loseRequirement   = new BoundedVersionRequirement("3");
                targetRequirement = new RangeVersionRequirement("3", "3.5");
                Assert.AreEqual(requirement.RestrictTo(loseRequirement), targetRequirement);
            }
            public void ResrictToMinimalRequirement()
            {
                MinimalVersionRequirement minimalRequirement;

                // When greater (1.1+)
                minimalRequirement = new MinimalVersionRequirement("1.1");
                Assert.Throws <IncompatibleRequirementException>(
                    delegate
                {
                    requirement.RestrictTo(minimalRequirement);
                }
                    );

                // When more specific 1.0.4+
                minimalRequirement = new MinimalVersionRequirement("1.0.4");
                // Restricts to a new, more restrictive range
                IVersionRequirement targetRequirement = new RangeVersionRequirement("1.0.4", "1.1");

                Assert.AreEqual(requirement.RestrictTo(minimalRequirement), targetRequirement);

                // When lesser (0.9+)
                minimalRequirement = new MinimalVersionRequirement("0.9");
                Assert.AreSame(requirement.RestrictTo(minimalRequirement), requirement);
            }