public void ConstructorTest()
		{
			NuGenInt32 int32 = new NuGenInt32(10, 100);

			Assert.AreEqual(10, int32.Minimum);
			Assert.AreEqual(10, int32.Value);
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="NuGenPositiveInt32"/> class.
 /// </summary>
 public NuGenPositiveInt32()
 {
     _int = new NuGenInt32(1, int.MaxValue);
     _int.ValueChanged += delegate(object sender, EventArgs e)
     {
         this.OnValueChanged(e);
     };
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NuGenNonNegativeInt32"/> class.
 /// </summary>
 public NuGenNonNegativeInt32()
 {
     _int = new NuGenInt32(0, Int32.MaxValue);
     _int.ValueChanged += delegate(Object sender, EventArgs e)
     {
         this.OnValueChanged(e);
     };
 }
		public void EqualsTest()
		{
			NuGenInt32 compared = new NuGenInt32(0, 100);
			compared.Value = 50;

			_int.Value = 50;

			Assert.IsTrue(_int.Equals(compared));
			Assert.IsFalse(_int.Equals(null));

			compared.Value = 2;
			Assert.IsFalse(_int.Equals(compared));
		}
Example #5
0
        /*
         * Equals
         */

        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj is NuGenInt32)
            {
                NuGenInt32 compared = (NuGenInt32)obj;

                if (
                    compared.Value == this.Value &&
                    compared.Minimum == this.Minimum
                    )
                {
                    return(compared.Maximum == this.Maximum);
                }
            }

            return(false);
        }
Example #6
0
        /*
         * Equals
         */

        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        /// </returns>
        public override Boolean Equals(Object obj)
        {
            NuGenInt32 compared = obj as NuGenInt32;

            if (compared != null)
            {
                if (
                    compared.Value == this.Value &&
                    compared.Minimum == this.Minimum
                    )
                {
                    return(compared.Maximum == this.Maximum);
                }
            }

            return(false);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenNonNegativeInt32"/> class.
		/// </summary>
		public NuGenNonNegativeInt32()
		{
			_int = new NuGenInt32(0, int.MaxValue);
			_int.ValueChanged += delegate(object sender, EventArgs e)
			{
				this.OnValueChanged(e);
			};
		}
		public void SetUp()
		{
			_int = new NuGenInt32(_min, _max);
			_eventSink = new EventSink(_int);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenPositiveInt32"/> class.
		/// </summary>
		public NuGenPositiveInt32()
		{
			_int = new NuGenInt32(1, Int32.MaxValue);
			_int.ValueChanged += delegate(Object sender, EventArgs e)
			{
				this.OnValueChanged(e);
			};
		}