public void ConstructorTest() { NuGenInt32 int32 = new NuGenInt32(10, 100); Assert.AreEqual(10, int32.Minimum); Assert.AreEqual(10, int32.Value); }
public void EmptyTest() { NuGenInt32 empty = NuGenInt32.Empty; Assert.AreEqual(0, empty.Maximum); Assert.AreEqual(0, empty.Minimum); Assert.AreEqual(0, empty.Value); }
public void PositiveInt32ToInt32CastTest() { NuGenPositiveInt32 positiveInt32 = new NuGenPositiveInt32(); positiveInt32.Value = 1; NuGenInt32 int32 = positiveInt32; Assert.AreEqual(1, int32.Value); }
public void NonNegativeInt32ToInt32CastTest() { NuGenNonNegativeInt32 nonNegativeInt32 = new NuGenNonNegativeInt32(); nonNegativeInt32.Value = 1; NuGenInt32 int32 = nonNegativeInt32; Assert.AreEqual(1, int32.Value); }
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)); }
/// <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; } }
public void SetUp() { _int = new NuGenInt32(_min, _max); _eventSink = new EventSink(_int); }