public void ValueObjectTest()
        {
            SupportedMaxVersions vA = new SupportedMaxVersions(2009, 2010);
            SupportedMaxVersions vB = new SupportedMaxVersions(2009, 2010);
            SupportedMaxVersions vC = new SupportedMaxVersions(2012);

            Assert.IsTrue(vA.Equals(vB), "Same versions should be equal.");
            Assert.IsFalse(vA.Equals(vC), "Different versions should not be equal.");
            Assert.AreEqual(vA.GetHashCode(), vB.GetHashCode(), "Hash codes of same versions should be equal.");
        }
        public void IncludesTest()
        {
            SupportedMaxVersions v = new SupportedMaxVersions(2008, 2010);
            Assert.IsTrue(v.Includes(new SupportedMaxVersions(2009)), "2009 should be included");
            Assert.IsFalse(v.Includes(new SupportedMaxVersions(2011)), "2011 should not be included");

            v = SupportedMaxVersions.All;
            Assert.IsTrue(v.Includes(new SupportedMaxVersions(2009)), "All should include 2009");
            Assert.IsTrue(v.Includes(new SupportedMaxVersions(2020)), "All should include 2020");
        }
        public void ToStringTest()
        {
            SupportedMaxVersions v = SupportedMaxVersions.All;
            Assert.AreEqual("2008+", v.ToString(), "ToString method for all versions.");

            v = new SupportedMaxVersions(2010);
            Assert.AreEqual("2010", v.ToString(), "ToString with single supported version.");

            v = new SupportedMaxVersions(2009, 2010);
            Assert.AreEqual("2009-2010", v.ToString(), "ToString method for version range.");

            v = new SupportedMaxVersions(SupportedMaxVersions.NoBound, 2010);
            Assert.AreEqual("2008-2010", v.ToString(), "ToString method for no lower bound.");

            v = new SupportedMaxVersions(2010, SupportedMaxVersions.NoBound);
            Assert.AreEqual("2010+", v.ToString(), "ToString method for no upper bound.");
        }
        public void FromStringTest()
        {
            SupportedMaxVersions v = new SupportedMaxVersions("2008+");
            Assert.AreEqual(SupportedMaxVersions.All, v, "All");

            v = new SupportedMaxVersions("2008");
            Assert.AreEqual(new SupportedMaxVersions(2008), v, "2008");

            v = new SupportedMaxVersions("2009-2011");
            Assert.AreEqual(new SupportedMaxVersions(2009, 2011), v, "2009-2011");

            v = new SupportedMaxVersions("2009+");
            Assert.AreEqual(new SupportedMaxVersions(2009, SupportedMaxVersions.NoBound), v, "2009+");

            v = new SupportedMaxVersions("2008-2010");
            Assert.AreEqual(new SupportedMaxVersions(SupportedMaxVersions.NoBound, 2010), v, "2008-2010");
        }
        public void Start(SupportedMaxVersions value)
        {
            if (value.LowerBound != SupportedMaxVersions.NoBound)
            {
                this.minVersionCheckBox.Checked = true;
                this.minVersionSpinner.Value = value.LowerBound;
            }
            else
                this.minVersionCheckBox.Checked = false;

            if (value.UpperBound != SupportedMaxVersions.NoBound)
            {
                this.maxVersionCheckBox.Checked = true;
                this.maxVersionSpinner.Value = value.UpperBound;
            }
            else
                this.maxVersionCheckBox.Checked = false;
        }
 private void minVersionSpinner_ValueChanged(object sender, EventArgs e)
 {
     if (this.maxVersionSpinner.Value < this.minVersionSpinner.Value)
         this.maxVersionSpinner.Value = this.minVersionSpinner.Value;
 }
 public void LowerUpperBoundTest()
 {
     SupportedMaxVersions v = new SupportedMaxVersions(2009, 2011);
     Assert.AreEqual(2009, v.LowerBound, "Lower bound.");
     Assert.AreEqual(2011, v.UpperBound, "Upper bound.");
 }
 /// <summary>
 /// Returns true if the supplied object is within the bounds of this SupportedMaxVersions object.
 /// </summary>
 /// <param name="versions">The SupportedMaxVersions to test for.</param>
 public Boolean Includes(SupportedMaxVersions versions)
 {
     return (_lowerBound <= versions._lowerBound) && ((_upperBound >= versions._upperBound) || (_upperBound == NoBound));
 }