void ConstructorThrows() { IClampedPropertyT <Version> prop = null; Test.If.Action.ThrowsException(() => prop = new ClampedPropertyT <Version>(null, new Version(1, 1), new Version(1, 3)), out ArgumentNullException argEx); Test.IfNot.Object.IsNull(argEx); Test.If.Value.IsEqual(argEx.ParamName, "value"); Test.If.Object.IsNull(prop); }
void Constructor <TValue>(TValue input1, TValue input2, TValue input3, TValue value, TValue min, TValue max) where TValue : IComparable <TValue> { IClampedPropertyT <TValue> prop = null; Test.IfNot.Action.ThrowsException(() => prop = new ClampedPropertyT <TValue>(input1, input2, input3), out Exception ex); Test.IfNot.Object.IsNull(prop); Test.If.Value.IsEqual(prop.Minimum, min); Test.If.Value.IsEqual(prop.Maximum, max); Test.If.Value.IsEqual(prop.Value, value); }
void RaisePropertyChangedEvent <TValue>(IClampedPropertyT <TValue> prop, TValue v, TValue min, TValue max, Action action, IEnumerable <EventData <PropertyChangedEventArgs> > expected) where TValue : IComparable <TValue> { prop.Minimum = min; prop.Maximum = max; prop.Value = v; if (expected.Count() > 0) { Test.If.Action.RaisesPropertyChangedEvent(action, prop, out EventDataCollection <PropertyChangedEventArgs> eventDatas); Test.If.Enumerable.Matches(eventDatas, expected, DynamicEqualityComparer.FromDelegate <EventData <PropertyChangedEventArgs> >( (x, y) => ReferenceEquals(x.Sender, y.Sender) && x.EventArgs.PropertyName == y.EventArgs.PropertyName, (obj) => obj.GetHashCode())); } else { Test.IfNot.Action.RaisesPropertyChangedEvent(action, prop, out EventDataCollection <PropertyChangedEventArgs> _); } }