Beispiel #1
0
        public void ConstructorTest()
        {
            NuGenInt32 int32 = new NuGenInt32(10, 100);

            Assert.AreEqual(10, int32.Minimum);
            Assert.AreEqual(10, int32.Value);
        }
Beispiel #2
0
        public void EmptyTest()
        {
            NuGenInt32 empty = NuGenInt32.Empty;

            Assert.AreEqual(0, empty.Maximum);
            Assert.AreEqual(0, empty.Minimum);
            Assert.AreEqual(0, empty.Value);
        }
Beispiel #3
0
        public void PositiveInt32ToInt32CastTest()
        {
            NuGenPositiveInt32 positiveInt32 = new NuGenPositiveInt32();

            positiveInt32.Value = 1;

            NuGenInt32 int32 = positiveInt32;

            Assert.AreEqual(1, int32.Value);
        }
Beispiel #4
0
        public void NonNegativeInt32ToInt32CastTest()
        {
            NuGenNonNegativeInt32 nonNegativeInt32 = new NuGenNonNegativeInt32();

            nonNegativeInt32.Value = 1;

            NuGenInt32 int32 = nonNegativeInt32;

            Assert.AreEqual(1, int32.Value);
        }
Beispiel #5
0
        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));
        }
Beispiel #6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="EventSink"/> class.
            /// </summary>
            public EventSink(NuGenInt32 eventBubbler)
            {
                Assert.IsNotNull(eventBubbler);

                eventBubbler.MaximumChanged += delegate
                {
                    _maximumChangedCount.Inc();
                };

                eventBubbler.MinimumChanged += delegate
                {
                    _minimumChangedCount.Inc();
                };

                eventBubbler.ValueChanged += delegate
                {
                    _valueChangedCount.Inc();
                };
            }
			/// <summary>
			/// Initializes a new instance of the <see cref="EventSink"/> class.
			/// </summary>
			public EventSink(NuGenInt32 eventBubbler)
			{
				Assert.IsNotNull(eventBubbler);

				eventBubbler.MaximumChanged += delegate
				{
					_maximumChangedCount.Inc();
				};

				eventBubbler.MinimumChanged += delegate
				{
					_minimumChangedCount.Inc();
				};

				eventBubbler.ValueChanged += delegate
				{
					_valueChangedCount.Inc();
				};
			}
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (_largeChange != null)
            {
                _largeChange.Dispose();
                _largeChange = null;
            }

            if (_smallChange != null)
            {
                _smallChange.Dispose();
                _smallChange = null;
            }

            if (_value != null)
            {
                _value.Dispose();
                _value = null;
            }
        }
Beispiel #9
0
 public void SetUp()
 {
     _int       = new NuGenInt32(_min, _max);
     _eventSink = new EventSink(_int);
 }