Exemplo n.º 1
0
        void ConstructorThrows()
        {
            IClampedProperty <Version> prop = null;

            Test.If.Action.ThrowsException(() => prop = new ClampedProperty <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);
        }
Exemplo n.º 2
0
        void Constructor <TValue>(TValue input1, TValue input2, TValue input3, TValue value, TValue min, TValue max)
            where TValue : IComparable
        {
            IClampedProperty <TValue> prop = null;

            Test.IfNot.Action.ThrowsException(() => prop = new ClampedProperty <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);
        }
Exemplo n.º 3
0
        void RaisePropertyChangedEvent <TValue>(IClampedProperty <TValue> prop, TValue v, TValue min, TValue max, Action action, IEnumerable <EventData <PropertyChangedEventArgs> > expected)
            where TValue : IComparable
        {
            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> _);
            }
        }