Inheritance: DependencyObject
Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the DockPanelTest class.
        /// </summary>
        public DockPanelTest()
            : base()
        {
            Func <DockPanel> initializer = () => DefaultDockPanelToTest;

            DockProperty = new DependencyPropertyTest <DockPanel, Dock>(this, "Dock")
            {
                Property            = DockPanel.DockProperty,
                Initializer         = initializer,
                IsAttached          = true,
                AttachedInitializer = () => new Button {
                    Content = "Test"
                },
                DefaultValue  = Dock.Left,
                OtherValues   = new Dock[] { Dock.Top, Dock.Right, Dock.Bottom },
                InvalidValues = new Dictionary <Dock, Type>
                {
                    { (Dock)(-1), typeof(ArgumentException) },
                    { (Dock)4, typeof(ArgumentException) },
                    { (Dock)10, typeof(ArgumentException) },
                    { (Dock)27, typeof(ArgumentException) },
                    { (Dock)int.MaxValue, typeof(ArgumentException) },
                    { (Dock)int.MinValue, typeof(ArgumentException) }
                }
            };
            LastChildFillProperty = new DependencyPropertyTest <DockPanel, bool>(this, "LastChildFill")
            {
                Property     = DockPanel.LastChildFillProperty,
                Initializer  = initializer,
                DefaultValue = true,
                OtherValues  = new bool[] { false }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AccordionItemTest"/> class.
        /// </summary>
        public AccordionItemTest()
        {
            BackgroundProperty.DefaultValue                 = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));
            BorderBrushProperty.DefaultValue                = new SolidColorBrush(Color.FromArgb(0xff, 0xec, 0xec, 0xec));
            BorderThicknessProperty.DefaultValue            = new Thickness(1);
            PaddingProperty.DefaultValue                    = new Thickness(0);
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue   = VerticalAlignment.Top;
            HorizontalAlignmentProperty.DefaultValue        = HorizontalAlignment.Stretch;

            Func <AccordionItem> initializer = () => DefaultAccordionItemToTest;

            ExpandDirectionProperty = new DependencyPropertyTest <AccordionItem, ExpandDirection>(this, "ExpandDirection")
            {
                Initializer  = initializer,
                Property     = AccordionItem.ExpandDirectionProperty,
                DefaultValue = ExpandDirection.Down,
                OtherValues  =
                    new[] { ExpandDirection.Up, ExpandDirection.Left, ExpandDirection.Right },
                InvalidValues = new Dictionary <ExpandDirection, Type>
                {
                    { (ExpandDirection)99, typeof(ArgumentOutOfRangeException) },
                    { (ExpandDirection)66, typeof(ArgumentOutOfRangeException) }
                }
            };
            IsSelectedProperty = new DependencyPropertyTest <AccordionItem, bool>(this, "IsSelected")
            {
                Initializer  = initializer,
                Property     = AccordionItem.IsSelectedProperty,
                DefaultValue = false,
                OtherValues  = new[] { true }
            };

            AccordionButtonStyleProperty = new DependencyPropertyTest <AccordionItem, Style>(this, "AccordionButtonStyle")
            {
                Initializer  = initializer,
                Property     = AccordionItem.AccordionButtonStyleProperty,
                DefaultValue = null,
                OtherValues  = new[] { new Style(typeof(AccordionButton)), new Style(typeof(Control)) }
            };

            ExpandableContentControlStyleProperty = new DependencyPropertyTest <AccordionItem, Style>(this, "ExpandableContentControlStyle")
            {
                Initializer  = initializer,
                Property     = AccordionItem.ExpandableContentControlStyleProperty,
                DefaultValue = null,
                OtherValues  = new[] { new Style(typeof(ExpandableContentControl)), new Style(typeof(Control)) }
            };

            ContentTargetSizeProperty = new DependencyPropertyTest <AccordionItem, Size>(this, "ContentTargetSize")
            {
                Property      = AccordionItem.ContentTargetSizeProperty,
                Initializer   = initializer,
                DefaultValue  = new Size(double.NaN, double.NaN),
                InvalidValues = new Dictionary <Size, Type>
                {
                    { new Size(5, 5), typeof(InvalidOperationException) }
                }
            };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the ItemsControlTest class.
        /// </summary>
        protected ItemsControlTest()
            : base()
        {
            Func <ItemsControl> initializer = () => DefaultItemsControlToTest;

            DisplayMemberPathProperty = new DependencyPropertyTest <ItemsControl, string>(this, "DisplayMemberPath")
            {
                Property     = ItemsControl.DisplayMemberPathProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new string[] { "Value" }
            };
            ItemsPanelProperty = new DependencyPropertyTest <ItemsControl, ItemsPanelTemplate>(this, "ItemsPanel")
            {
                Property     = ItemsControl.ItemsPanelProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new ItemsPanelTemplate[] { new ItemsPanelTemplate() }
            };
            ItemsSourceProperty = new DependencyPropertyTest <ItemsControl, IEnumerable>(this, "ItemsSource")
            {
                Property     = ItemsControl.ItemsSourceProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new IEnumerable[] { new int[] { 1, 2, 3 }, new string[] { "hello", "world" } }
            };
            ItemTemplateProperty = new DependencyPropertyTest <ItemsControl, DataTemplate>(this, "ItemTemplate")
            {
                Property     = ItemsControl.ItemTemplateProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new DataTemplate[] { new DataTemplate() }
            };
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the HeaderedItemsControlTest class.
 /// </summary>
 public HeaderedItemsControlTest()
     : base()
 {
     Func<HeaderedItemsControl> initializer = () => DefaultHeaderedItemsControlToTest;
     HeaderTemplateProperty = new DependencyPropertyTest<HeaderedItemsControl, DataTemplate>(this, "HeaderTemplate")
         {
             Property = HeaderedItemsControl.HeaderTemplateProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new DataTemplate[]
             {
                 new DataTemplate(),
                 new XamlBuilder<DataTemplate>().Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template" }).Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template", Children = new List<XamlBuilder> { new XamlBuilder<StackPanel>() } }).Load()
             }
         };
     HeaderProperty = new DependencyPropertyTest<HeaderedItemsControl, object>(this, "Header")
         {
             Property = HeaderedItemsControl.HeaderProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new object[] { 12, "Test Text", Environment.OSVersion, new Ellipse { Fill = new SolidColorBrush(Colors.Red), Width = 20, Height = 20 } },
             TemplateProperty = HeaderTemplateProperty
         };
     ItemContainerStyleProperty = new DependencyPropertyTest<HeaderedItemsControl, Style>(this, "ItemContainerStyle")
         {
             Property = HeaderedItemsControl.ItemContainerStyleProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new Style[] { new Style(typeof(HeaderedItemsControl)), new Style(typeof(ItemsControl)), new Style(typeof(Control)) }
         };
 }
 /// <summary>
 /// Initializes a new instance of the HeaderedItemsControlTest class.
 /// </summary>
 public HeaderedItemsControlTest()
     : base()
 {
     Func<HeaderedItemsControl> initializer = () => DefaultHeaderedItemsControlToTest;
     HeaderTemplateProperty = new DependencyPropertyTest<HeaderedItemsControl, DataTemplate>(this, "HeaderTemplate")
         {
             Property = HeaderedItemsControl.HeaderTemplateProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new DataTemplate[]
             {
                 new DataTemplate(),
                 new XamlBuilder<DataTemplate>().Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template" }).Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template", Children = new List<XamlBuilder> { new XamlBuilder<StackPanel>() } }).Load()
             }
         };
     HeaderProperty = new DependencyPropertyTest<HeaderedItemsControl, object>(this, "Header")
         {
             Property = HeaderedItemsControl.HeaderProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new object[] { 12, "Test Text", Environment.OSVersion, new Ellipse { Fill = new SolidColorBrush(Colors.Red), Width = 20, Height = 20 } },
             TemplateProperty = HeaderTemplateProperty
         };
     ItemContainerStyleProperty = new DependencyPropertyTest<HeaderedItemsControl, Style>(this, "ItemContainerStyle")
         {
             Property = HeaderedItemsControl.ItemContainerStyleProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new Style[] { new Style(typeof(HeaderedItemsControl)), new Style(typeof(ItemsControl)), new Style(typeof(Control)) }
         };
 }
        /////// <summary>
        /////// Gets the IsCyclic dependency property test.
        /////// </summary>
        ////[SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures", Justification = "By design for testing.")]
        ////protected DependencyPropertyTest<UpDownBase<T>, bool> IsCyclicProperty { get; private set; }

        /// <summary>
        /// Initializes a new instance of the UpDownBaseTest&lt;T&gt; class.
        /// </summary>
        protected UpDownBaseTest()
        {
            Func <UpDownBase <T> > initializer = () => DefaultUpDownBaseTToTest;

            ValueProperty = new DependencyPropertyTest <UpDownBase <T>, T>(this, "Value")
            {
                Property     = UpDownBase <T> .ValueProperty,
                Initializer  = initializer,
                DefaultValue = default(T),
                OtherValues  = new T[] { }
            };
            IsEditableProperty = new DependencyPropertyTest <UpDownBase <T>, bool>(this, "IsEditable")
            {
                Property     = UpDownBase <T> .IsEditableProperty,
                Initializer  = initializer,
                DefaultValue = true,
                OtherValues  = new bool[] { false }
            };
            ////IsCyclicProperty = new DependencyPropertyTest<UpDownBase<T>, bool>(this, "IsCyclic")
            ////{
            ////    Property = UpDownBase<T>.IsCyclicProperty,
            ////    Initializer = initializer,
            ////    DefaultValue = false,
            ////    OtherValues = new bool[] { true }
            ////};
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="ExpandableContentControlTest"/> class.
        /// </summary>
        public ExpandableContentControlTest()
        {
            Func <ExpandableContentControl> initializer = () => DefaultExpandableContentControlToTest;

            RevealModeProperty = new DependencyPropertyTest <ExpandableContentControl, ExpandDirection>(this, "RevealMode")
            {
                Property     = ExpandableContentControl.RevealModeProperty,
                Initializer  = initializer,
                DefaultValue = ExpandDirection.Down,
                OtherValues  =
                    new[] { ExpandDirection.Left, ExpandDirection.Right, ExpandDirection.Up }
            };
            PercentageProperty = new DependencyPropertyTest <ExpandableContentControl, double>(this, "Percentage")
            {
                Property     = ExpandableContentControl.PercentageProperty,
                Initializer  = initializer,
                DefaultValue = 0,
                OtherValues  = new[] { 1.0 }
            };
            TargetSizeProperty = new DependencyPropertyTest <ExpandableContentControl, Size>(this, "TargetSize")
            {
                Property     = ExpandableContentControl.TargetSizeProperty,
                Initializer  = initializer,
                DefaultValue = new Size(double.NaN, double.NaN),
                OtherValues  = new[] { new Size(10, 10) }
            };
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the ItemsControlTest class.
 /// </summary>
 protected ItemsControlTest()
     : base()
 {
     Func<ItemsControl> initializer = () => DefaultItemsControlToTest;
     DisplayMemberPathProperty = new DependencyPropertyTest<ItemsControl, string>(this, "DisplayMemberPath")
         {
             Property = ItemsControl.DisplayMemberPathProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new string[] { "Value" }
         };
     ItemsPanelProperty = new DependencyPropertyTest<ItemsControl, ItemsPanelTemplate>(this, "ItemsPanel")
         {
             Property = ItemsControl.ItemsPanelProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new ItemsPanelTemplate[] { new ItemsPanelTemplate() }
         };
     ItemsSourceProperty = new DependencyPropertyTest<ItemsControl, IEnumerable>(this, "ItemsSource")
         {
             Property = ItemsControl.ItemsSourceProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new IEnumerable[] { new int[] { 1, 2, 3 }, new string[] { "hello", "world" } }
         };
     ItemTemplateProperty = new DependencyPropertyTest<ItemsControl, DataTemplate>(this, "ItemTemplate")
         {
             Property = ItemsControl.ItemTemplateProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new DataTemplate[] { new DataTemplate() }
         };
 }
Ejemplo n.º 9
0
    }   // End property Second

    private static void FirstPropertyChanged(DependencyObject dependencyObject,
                                             DependencyPropertyChangedEventArgs ea)
    {
        DependencyPropertyTest instance = dependencyObject as DependencyPropertyTest;

        if (instance == null)
        {
            return;
        }

        instance.Second = String.Format("First is {0}.", ((bool)ea.NewValue).ToString());
    } // End method FirstPropertyChanged
Ejemplo n.º 10
0
  /// <summary>
 /// Initializes a new instance of the UpDownBaseTest class.
 /// </summary>
 protected UpDownBaseTest()
     : base()
 {
     Func<UpDownBase> initializer = () => DefaultUpDownBaseToTest;
     SpinnerStyleProperty = new DependencyPropertyTest<UpDownBase, Style>(this, "SpinnerStyle")
     {
         Property = UpDownBase.SpinnerStyleProperty,
         Initializer = initializer,
         DefaultValue = null,
         OtherValues = new Style[] { new Style(typeof(ButtonSpinner)) }
     };
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the UpDownBaseTest class.
        /// </summary>
        protected UpDownBaseTest()
            : base()
        {
            Func <UpDownBase> initializer = () => DefaultUpDownBaseToTest;

            SpinnerStyleProperty = new DependencyPropertyTest <UpDownBase, Style>(this, "SpinnerStyle")
            {
                Property     = UpDownBase.SpinnerStyleProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new Style[] { new Style(typeof(ButtonSpinner)) }
            };
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="ClipperTest"/> class.
        /// </summary>
        protected ClipperTest()
        {
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue   = VerticalAlignment.Top;

            Func <Clipper> initializer = () => DefaultClipperToTest;

            RatioVisibleProperty = new DependencyPropertyTest <Clipper, double>(this, "RatioVisible")
            {
                Property     = Clipper.RatioVisibleProperty,
                Initializer  = initializer,
                DefaultValue = 1.0,
                OtherValues  = new[] { 0.0 }
            };
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the HeaderedContentControlTest class.
        /// </summary>
        public HeaderedContentControlTest()
            : base()
        {
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue   = VerticalAlignment.Top;

            Func <HeaderedContentControl> initializer = () => DefaultHeaderedContentControlToTest;

            HeaderTemplateProperty = new DependencyPropertyTest <HeaderedContentControl, DataTemplate>(this, "HeaderTemplate")
            {
                Property     = HeaderedContentControl.HeaderTemplateProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new DataTemplate[]
                {
                    new DataTemplate(),
                    new XamlBuilder <DataTemplate>().Load(),
                    (new XamlBuilder <DataTemplate> {
                        Name = "Template"
                    }).Load(),
                    (new XamlBuilder <DataTemplate> {
                        Name = "Template", Children = new List <XamlBuilder> {
                            new XamlBuilder <StackPanel>()
                        }
                    }).Load()
                }
            };
            HeaderProperty = new DependencyPropertyTest <HeaderedContentControl, object>(this, "Header")
            {
                Property     = HeaderedContentControl.HeaderProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new object[]
                {
                    12,
                    string.Empty,
                    "Test Text",
                    Environment.OSVersion,
                    new Ellipse {
                        Fill = new SolidColorBrush(Colors.Red), Width = 20, Height = 20
                    }
                },
                TemplateProperty = HeaderTemplateProperty
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RangeTimePickerPopupTest"/> class.
        /// </summary>
        public RangeTimePickerPopupTest()
        {
            Func<RangeTimePickerPopup> initializer = () => new RangeTimePickerPopup();

            SliderStyleProperty = new DependencyPropertyTest<RangeTimePickerPopup, Style>(this, "SliderStyle")
            {
                Property = RangeTimePickerPopup.SliderStyleProperty,
                Initializer = initializer,
                OtherValues = new[] { new Style(typeof(RangeBase)), new Style(typeof(Control)) }
            };

            TimeButtonStyleProperty = new DependencyPropertyTest<RangeTimePickerPopup, Style>(this, "TimeButtonStyle")
            {
                Property = RangeTimePickerPopup.TimeButtonStyleProperty,
                Initializer = initializer,
                OtherValues = new[] { new Style(typeof(Button)), new Style(typeof(Control)) }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RangeTimePickerPopupTest"/> class.
        /// </summary>
        public RangeTimePickerPopupTest()
        {
            Func <RangeTimePickerPopup> initializer = () => new RangeTimePickerPopup();

            SliderStyleProperty = new DependencyPropertyTest <RangeTimePickerPopup, Style>(this, "SliderStyle")
            {
                Property    = RangeTimePickerPopup.SliderStyleProperty,
                Initializer = initializer,
                OtherValues = new[] { new Style(typeof(RangeBase)), new Style(typeof(Control)) }
            };

            TimeButtonStyleProperty = new DependencyPropertyTest <RangeTimePickerPopup, Style>(this, "TimeButtonStyle")
            {
                Property    = RangeTimePickerPopup.TimeButtonStyleProperty,
                Initializer = initializer,
                OtherValues = new[] { new Style(typeof(Button)), new Style(typeof(Control)) }
            };
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the ExpanderTest class.
        /// </summary>
        public ExpanderTest()
            : base()
        {
            BorderThicknessProperty.DefaultValue            = new Thickness(1);
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Stretch;
            VerticalContentAlignmentProperty.DefaultValue   = VerticalAlignment.Stretch;

            Func <ContentControl> expandedInitializer =
                () =>
            {
                Expander expander = DefaultExpanderToTest;
                expander.IsExpanded = true;
                return(expander);
            };

            ContentProperty.Initializer = expandedInitializer;

            Func <Expander> initializer = () => DefaultExpanderToTest;

            IsExpandedProperty = new DependencyPropertyTest <Expander, bool>(this, "IsExpanded")
            {
                Property     = Expander.IsExpandedProperty,
                Initializer  = initializer,
                DefaultValue = false,
                OtherValues  = new bool[] { true }
            };
            ExpandDirectionProperty = new DependencyPropertyTest <Expander, ExpandDirection>(this, "ExpandDirection")
            {
                Property      = Expander.ExpandDirectionProperty,
                Initializer   = initializer,
                DefaultValue  = ExpandDirection.Down,
                OtherValues   = new ExpandDirection[] { ExpandDirection.Up, ExpandDirection.Left, ExpandDirection.Right },
                InvalidValues = new Dictionary <ExpandDirection, Type>
                {
                    { (ExpandDirection)(-1), typeof(ArgumentException) },
                    { (ExpandDirection)4, typeof(ArgumentException) },
                    { (ExpandDirection)5, typeof(ArgumentException) },
                    { (ExpandDirection)500, typeof(ArgumentException) },
                    { (ExpandDirection)int.MaxValue, typeof(ArgumentException) },
                    { (ExpandDirection)int.MinValue, typeof(ArgumentException) }
                }
            };
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the TreeViewTest class.
        /// </summary>
        public TreeViewTest()
            : base()
        {
            BackgroundProperty.DefaultValue      = new SolidColorBrush(Colors.White);
            BorderBrushProperty.DefaultValue     = new SolidColorBrush(Colors.Black);
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue         = new Thickness(1);

            Func <TreeView> initializer = () => DefaultTreeViewToTest;

            SelectedItemProperty = new DependencyPropertyTest <TreeView, object>(this, "SelectedItem")
            {
                Property     = TreeView.SelectedItemProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new object[] { new object() }
            };
            SelectedValueProperty = new DependencyPropertyTest <TreeView, object>(this, "SelectedValue")
            {
                Property     = TreeView.SelectedValueProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new object[] { new object() }
            };
            SelectedValuePathProperty = new DependencyPropertyTest <TreeView, string>(this, "SelectedValuePath")
            {
                Property     = TreeView.SelectedValuePathProperty,
                Initializer  = initializer,
                DefaultValue = "",
                OtherValues  = new string[] { "Value", null }
            };
            ItemContainerStyleProperty = new DependencyPropertyTest <TreeView, Style>(this, "ItemContainerStyle")
            {
                Property     = TreeView.ItemContainerStyleProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new Style[] { new Style(typeof(HeaderedItemsControl)), new Style(typeof(ItemsControl)), new Style(typeof(Control)) }
            };

            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue   = VerticalAlignment.Top;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ListTimePickerPopupTest"/> class.
        /// </summary>
        public ListTimePickerPopupTest()
        {
            Func<ListTimePickerPopup> initializer = () => new ListTimePickerPopup();

            ListBoxStyleProperty = new DependencyPropertyTest<ListTimePickerPopup, Style>(this, "ListBoxStyle")
            {
                Property = ListTimePickerPopup.ListBoxStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new Style(typeof(ListBox)), new Style(typeof(Control)) }
            };

            ListBoxItemStyleProperty = new DependencyPropertyTest<ListTimePickerPopup, Style>(this, "ListBoxItemStyle")
            {
                Property = ListTimePickerPopup.ListBoxItemStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new Style(typeof(ListBoxItem)), new Style(typeof(Control)) }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ListTimePickerPopupTest"/> class.
        /// </summary>
        public ListTimePickerPopupTest()
        {
            Func <ListTimePickerPopup> initializer = () => new ListTimePickerPopup();

            ListBoxStyleProperty = new DependencyPropertyTest <ListTimePickerPopup, Style>(this, "ListBoxStyle")
            {
                Property     = ListTimePickerPopup.ListBoxStyleProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new Style(typeof(ListBox)), new Style(typeof(Control)) }
            };

            ListBoxItemStyleProperty = new DependencyPropertyTest <ListTimePickerPopup, Style>(this, "ListBoxItemStyle")
            {
                Property     = ListTimePickerPopup.ListBoxItemStyleProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new Style(typeof(ListBoxItem)), new Style(typeof(Control)) }
            };
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the ExpanderTest class.
        /// </summary>
        public ExpanderTest()
            : base()
        {
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Stretch;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Stretch;

            Func<ContentControl> expandedInitializer =
                () =>
                {
                    Expander expander = DefaultExpanderToTest;
                    expander.IsExpanded = true;
                    return expander;
                };
            ContentProperty.Initializer = expandedInitializer;

            Func<Expander> initializer = () => DefaultExpanderToTest;
            IsExpandedProperty = new DependencyPropertyTest<Expander, bool>(this, "IsExpanded")
            {
                Property = Expander.IsExpandedProperty,
                Initializer = initializer,
                DefaultValue = false,
                OtherValues = new bool[] { true }
            };
            ExpandDirectionProperty = new DependencyPropertyTest<Expander, ExpandDirection>(this, "ExpandDirection")
            {
                Property = Expander.ExpandDirectionProperty,
                Initializer = initializer,
                DefaultValue = ExpandDirection.Down,
                OtherValues = new ExpandDirection[] { ExpandDirection.Up, ExpandDirection.Left, ExpandDirection.Right },
                InvalidValues = new Dictionary<ExpandDirection, Type>
                {
                    { (ExpandDirection)(-1), typeof(ArgumentException) },
                    { (ExpandDirection)4, typeof(ArgumentException) },
                    { (ExpandDirection)5, typeof(ArgumentException) },
                    { (ExpandDirection)500, typeof(ArgumentException) },
                    { (ExpandDirection)int.MaxValue, typeof(ArgumentException) },
                    { (ExpandDirection)int.MinValue, typeof(ArgumentException) }
                }
            };
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RatingItemTest"/> class.
        /// </summary>
        public RatingItemTest()
        {
            Func <RatingItem> initializer = () => DefaultRatingItemToTest;

            DisplayValueProperty =
                new DependencyPropertyTest <RatingItem, double>(this, "DisplayValue")
            {
                Initializer  = initializer,
                Property     = RatingItem.DisplayValueProperty,
                DefaultValue = 0.0,
                OtherValues  = new[] { 1.0, 0.5 }
            };

            IsReadOnlyProperty = new DependencyPropertyTest <RatingItem, bool>(this, "IsReadOnly")
            {
                Property     = RatingItem.IsReadOnlyProperty,
                Initializer  = () => DefaultRatingItemToTest,
                DefaultValue = false,
                OtherValues  = new bool[] { true }
            };
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the TreeViewItemTest class.
        /// </summary>
        public TreeViewItemTest()
            : base()
        {
            BackgroundProperty.DefaultValue = new SolidColorBrush(Colors.Transparent);
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue = new Thickness(3);

            Func<TreeViewItem> initializer = () => DefaultTreeViewItemToTest;
            HasItemsProperty = new DependencyPropertyTest<TreeViewItem, bool>(this, "HasItems")
                {
                    Property = TreeViewItem.HasItemsProperty,
                    Initializer = initializer,
                    DefaultValue = false,
                    OtherValues = new bool[] { true }
                };
            IsExpandedProperty = new DependencyPropertyTest<TreeViewItem, bool>(this, "IsExpanded")
                {
                    Property = TreeViewItem.IsExpandedProperty,
                    Initializer = initializer,
                    DefaultValue = false,
                    OtherValues = new bool[] { true }
                };
            IsSelectedProperty = new DependencyPropertyTest<TreeViewItem, bool>(this, "IsSelected")
                {
                    Property = TreeViewItem.IsSelectedProperty,
                    Initializer = initializer,
                    DefaultValue = false,
                    OtherValues = new bool[] { true }
                };
            IsSelectionActiveProperty = new DependencyPropertyTest<TreeViewItem, bool>(this, "IsSelectionActive")
                {
                    Property = TreeViewItem.IsSelectionActiveProperty,
                    Initializer = initializer,
                    DefaultValue = false,
                    OtherValues = new bool[] { true }
                };

            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Initializes a new instance of the ViewboxTest class.
        /// </summary>
        public ViewboxTest()
            : base()
        {
            Func <Viewbox> initializer = () => DefaultViewboxToTest;

            StretchProperty = new DependencyPropertyTest <Viewbox, Stretch>(this, "Stretch")
            {
                Property      = Viewbox.StretchProperty,
                Initializer   = initializer,
                DefaultValue  = Stretch.Uniform,
                OtherValues   = new Stretch[] { Stretch.None, Stretch.Fill, Stretch.UniformToFill },
                InvalidValues = new Dictionary <Stretch, Type>
                {
                    { (Stretch)(-1), typeof(ArgumentException) },
                    { (Stretch)4, typeof(ArgumentException) },
                    { (Stretch)5, typeof(ArgumentException) },
                    { (Stretch)500, typeof(ArgumentException) },
                    { (Stretch)int.MaxValue, typeof(ArgumentException) },
                    { (Stretch)int.MinValue, typeof(ArgumentException) }
                }
            };

            StretchDirectionProperty = new DependencyPropertyTest <Viewbox, StretchDirection>(this, "StretchDirection")
            {
                Property      = Viewbox.StretchDirectionProperty,
                Initializer   = initializer,
                DefaultValue  = StretchDirection.Both,
                OtherValues   = new StretchDirection[] { StretchDirection.DownOnly, StretchDirection.UpOnly },
                InvalidValues = new Dictionary <StretchDirection, Type>
                {
                    { (StretchDirection)(-1), typeof(ArgumentException) },
                    { (StretchDirection)3, typeof(ArgumentException) },
                    { (StretchDirection)4, typeof(ArgumentException) },
                    { (StretchDirection)500, typeof(ArgumentException) },
                    { (StretchDirection)int.MaxValue, typeof(ArgumentException) },
                    { (StretchDirection)int.MinValue, typeof(ArgumentException) }
                }
            };
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the TreeMapTest class.
        /// </summary>
        public TreeMapTest()
            : base()
        {
            Func <TreeMap> initializer = () => DefaultTreeMapToTest;

            TreeMapItemDefinitionSelectorProperty = new DependencyPropertyTest <TreeMap, TreeMapItemDefinitionSelector>(this, "TreeMapItemDefinitionSelector")
            {
                Property     = TreeMap.ItemDefinitionSelectorProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new OverriddenTreeMapItemDefinitionSelector() }
            };
            ItemDefinitionProperty = new DependencyPropertyTest <TreeMap, TreeMapItemDefinition>(this, "ItemDefinition")
            {
                Property    = TreeMap.ItemDefinitionProperty,
                Initializer = initializer,
                OtherValues = new TreeMapItemDefinition[] { new TreeMapItemDefinition() }
            };

            ItemsSourceProperty = new DependencyPropertyTest <TreeMap, IEnumerable>(this, "ItemsSource")
            {
                Property     = TreeMap.ItemsSourceProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new IList[] { new string[] { }, null }
                // OtherValues = new IList[] { new string[] { "hello", "world" }, null } - not used as ItemDefinition must be set
            };

            InterpolatorsProperty = new DependencyPropertyTest <TreeMap, IList>(this, "Interpolators")
            {
                Property     = TreeMap.InterpolatorsProperty,
                Initializer  = initializer,
                DefaultValue = new ObservableCollection <Interpolator>(),
                OtherValues  = new IList[] { new List <Interpolator>()
                                             {
                                             } }
            };
        }
Ejemplo n.º 25
0
        public RatingTest()
        {
            Func <Rating> initializer = () => new Rating();

            SelectionModeProperty =
                new DependencyPropertyTest <Rating, RatingSelectionMode>(this, "SelectionMode")
            {
                Property     = Rating.SelectionModeProperty,
                Initializer  = initializer,
                DefaultValue = RatingSelectionMode.Continuous,
                OtherValues  =
                    new[]
                {
                    RatingSelectionMode.Individual
                },
                InvalidValues =
                    new Dictionary <RatingSelectionMode, Type>
                {
                    { (RatingSelectionMode)99, typeof(ArgumentOutOfRangeException) },
                    { (RatingSelectionMode)66, typeof(ArgumentOutOfRangeException) }
                }
            };

            ItemContainerStyleProperty =
                new DependencyPropertyTest <Rating, Style>(this, "ItemContainerStyle")
            {
                Property     = Rating.ItemContainerStyleProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  =
                    new[]
                {
                    new Style(typeof(HeaderedItemsControl)),
                    new Style(typeof(ItemsControl)),
                    new Style(typeof(Control))
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the FrameworkElementTest class.
        /// </summary>
        protected FrameworkElementTest()
            : base()
        {
            Func <FrameworkElement> initializer = () => DefaultFrameworkElementToTest;

            HorizontalAlignmentProperty = new DependencyPropertyTest <FrameworkElement, HorizontalAlignment>(this, "HorizontalAlignment")
            {
                Property      = FrameworkElement.HorizontalAlignmentProperty,
                Initializer   = initializer,
                DefaultValue  = HorizontalAlignment.Stretch,
                OtherValues   = new HorizontalAlignment[] { HorizontalAlignment.Right, HorizontalAlignment.Left, HorizontalAlignment.Stretch, HorizontalAlignment.Center },
                InvalidValues = new Dictionary <HorizontalAlignment, Type>
                {
                    { (HorizontalAlignment)(-1), typeof(OverflowException) },
                    { (HorizontalAlignment)4, typeof(ArgumentException) },
                    { (HorizontalAlignment)10, typeof(ArgumentException) },
                    { (HorizontalAlignment)27, typeof(ArgumentException) },
                    { (HorizontalAlignment)int.MaxValue, typeof(OverflowException) },
                    { (HorizontalAlignment)int.MinValue, typeof(OverflowException) }
                }
            };
            VerticalAlignmentProperty = new DependencyPropertyTest <FrameworkElement, VerticalAlignment>(this, "VerticalAlignment")
            {
                Property      = FrameworkElement.VerticalAlignmentProperty,
                Initializer   = initializer,
                DefaultValue  = VerticalAlignment.Stretch,
                OtherValues   = new VerticalAlignment[] { VerticalAlignment.Bottom, VerticalAlignment.Top, VerticalAlignment.Center, VerticalAlignment.Stretch },
                InvalidValues = new Dictionary <VerticalAlignment, Type>
                {
                    { (VerticalAlignment)(-1), typeof(OverflowException) },
                    { (VerticalAlignment)4, typeof(ArgumentException) },
                    { (VerticalAlignment)10, typeof(ArgumentException) },
                    { (VerticalAlignment)27, typeof(ArgumentException) },
                    { (VerticalAlignment)int.MaxValue, typeof(OverflowException) },
                    { (VerticalAlignment)int.MinValue, typeof(OverflowException) }
                }
            };
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PickerTest"/> class.
        /// </summary>
        protected PickerTest()
        {
            Func <Picker> initalizer = () => DefaultPickerToTest;

            IsDropDownOpenProperty = new DependencyPropertyTest <Picker, bool>(this, "IsDropDownOpen")
            {
                Property     = Picker.IsDropDownOpenProperty,
                DefaultValue = false,
                Initializer  = initalizer,
                OtherValues  = new[] { true },
            };

            PopupButtonModeProperty = new DependencyPropertyTest <Picker, ClickMode>(this, "PopupButtonMode")
            {
                Property      = Picker.PopupButtonModeProperty,
                DefaultValue  = ClickMode.Release,
                Initializer   = initalizer,
                OtherValues   = new[] { ClickMode.Release, ClickMode.Hover },
                InvalidValues = new Dictionary <ClickMode, Type>
                {
                    { (ClickMode)23, typeof(ArgumentException) },
                    { (ClickMode)65, typeof(ArgumentException) },
                }
            };

            MaxDropDownHeightProperty = new DependencyPropertyTest <Picker, double>(this, "MaxDropDownHeight")
            {
                Property      = Picker.MaxDropDownHeightProperty,
                DefaultValue  = double.PositiveInfinity,
                Initializer   = initalizer,
                OtherValues   = new[] { 1.0, 250.0, 10000.0 },
                InvalidValues = new Dictionary <double, Type>
                {
                    { -1.0, typeof(ArgumentException) },
                    { -11234.4, typeof(ArgumentException) },
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="TransitioningContentControlTest"/> class.
        /// </summary>
        public TransitioningContentControlTest()
        {
            // control should not be used with UIElements
            ContentProperty.OtherValues = new object[] { 12, "Test Text", Environment.OSVersion };

            Func <TransitioningContentControl> initializer = () => new TransitioningContentControl();

            TransitionProperty = new DependencyPropertyTest <TransitioningContentControl, string>(this, "Transition")
            {
                Initializer  = initializer,
                Property     = TransitioningContentControl.TransitionProperty,
                DefaultValue = "DefaultTransition",
                OtherValues  = new[] { "UpTransition", "DownTransition" }
            };

            RestartTransitionProperty = new DependencyPropertyTest <TransitioningContentControl, bool>(this, "RestartTransitionOnContentChange")
            {
                Initializer  = initializer,
                Property     = TransitioningContentControl.RestartTransitionOnContentChangeProperty,
                DefaultValue = false,
                OtherValues  = new[] { true }
            };
        }
 /// <summary>
 /// Initializes a new instance of the FrameworkElementTest class.
 /// </summary>
 protected FrameworkElementTest()
     : base()
 {
     Func<FrameworkElement> initializer = () => DefaultFrameworkElementToTest;
     HorizontalAlignmentProperty = new DependencyPropertyTest<FrameworkElement, HorizontalAlignment>(this, "HorizontalAlignment")
         {
             Property = FrameworkElement.HorizontalAlignmentProperty,
             Initializer = initializer,
             DefaultValue = HorizontalAlignment.Stretch,
             OtherValues = new HorizontalAlignment[] { HorizontalAlignment.Right, HorizontalAlignment.Left, HorizontalAlignment.Stretch, HorizontalAlignment.Center },
             InvalidValues = new Dictionary<HorizontalAlignment, Type>
             {
                 { (HorizontalAlignment)(-1), typeof(OverflowException) },
                 { (HorizontalAlignment)4, typeof(ArgumentException) },
                 { (HorizontalAlignment)10, typeof(ArgumentException) },
                 { (HorizontalAlignment)27, typeof(ArgumentException) },
                 { (HorizontalAlignment)int.MaxValue, typeof(OverflowException) },
                 { (HorizontalAlignment)int.MinValue, typeof(OverflowException) }
             }
         };
     VerticalAlignmentProperty = new DependencyPropertyTest<FrameworkElement, VerticalAlignment>(this, "VerticalAlignment")
         {
             Property = FrameworkElement.VerticalAlignmentProperty,
             Initializer = initializer,
             DefaultValue = VerticalAlignment.Stretch,
             OtherValues = new VerticalAlignment[] { VerticalAlignment.Bottom, VerticalAlignment.Top, VerticalAlignment.Center, VerticalAlignment.Stretch },
             InvalidValues = new Dictionary<VerticalAlignment, Type>
             {
                 { (VerticalAlignment)(-1), typeof(OverflowException) },
                 { (VerticalAlignment)4, typeof(ArgumentException) },
                 { (VerticalAlignment)10, typeof(ArgumentException) },
                 { (VerticalAlignment)27, typeof(ArgumentException) },
                 { (VerticalAlignment)int.MaxValue, typeof(OverflowException) },
                 { (VerticalAlignment)int.MinValue, typeof(OverflowException) }
             }
         };
 }
        public GlobalCalendarTest()
        {
            LinearGradientBrush backgroundBrush = new LinearGradientBrush
            {
                StartPoint = new Point(.5, 0),
                EndPoint = new Point(.5, 1)
            };
            backgroundBrush.GradientStops.Add(new GradientStop { Offset = 0, Color = Color.FromArgb(0xFF, 0xD3, 0xDE, 0xE8) });
            backgroundBrush.GradientStops.Add(new GradientStop { Offset = 0.16, Color = Color.FromArgb(0xFF, 0xD3, 0xDE, 0xE8) });
            backgroundBrush.GradientStops.Add(new GradientStop { Offset = 0.16, Color = Color.FromArgb(0xFF, 0xFC, 0xFC, 0xFD) });
            backgroundBrush.GradientStops.Add(new GradientStop { Offset = 1, Color = Colors.White });
            BackgroundProperty.DefaultValue = backgroundBrush;

            LinearGradientBrush borderBrush = new LinearGradientBrush
            {
                StartPoint = new Point(.5, 0),
                EndPoint = new Point(.5, 1)
            };
            borderBrush.GradientStops.Add(new GradientStop { Offset = 0, Color = Color.FromArgb(0xFF, 0xA3, 0xAE, 0xB9) });
            borderBrush.GradientStops.Add(new GradientStop { Offset = 0.375, Color = Color.FromArgb(0xFF, 0x83, 0x99, 0xA9) });
            borderBrush.GradientStops.Add(new GradientStop { Offset = 0.375, Color = Color.FromArgb(0xFF, 0x71, 0x85, 0x97) });
            borderBrush.GradientStops.Add(new GradientStop { Offset = 1, Color = Color.FromArgb(0xFF, 0x61, 0x75, 0x84) });
            BorderBrushProperty.DefaultValue = borderBrush;

            BorderThicknessProperty.DefaultValue = new Thickness(1);

            Func<GlobalCalendar> initializer = () => DefaultGlobalCalendarToTest;
            CalendarButtonStyleProperty = new DependencyPropertyTest<GlobalCalendar, Style>(this, "CalendarButtonStyle")
            {
                Property = GlobalCalendar.CalendarButtonStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new Style[] { new Style { TargetType = typeof(GlobalCalendarButton) }, new Style { TargetType = typeof(Control) } },
                InvalidValues = new Dictionary<Style, Type> { { new Style { TargetType = typeof(CalendarButton) }, typeof(ArgumentException) } }
            };
            CalendarDayButtonStyleProperty = new DependencyPropertyTest<GlobalCalendar, Style>(this, "CalendarDayButtonStyle")
            {
                Property = GlobalCalendar.CalendarDayButtonStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new Style[] { new Style { TargetType = typeof(GlobalCalendarDayButton) }, new Style { TargetType = typeof(Control) } },
                InvalidValues = new Dictionary<Style, Type> { { new Style { TargetType = typeof(CalendarButton) }, typeof(ArgumentException) } }
            };
            CalendarItemStyleProperty = new DependencyPropertyTest<GlobalCalendar, Style>(this, "CalendarItemStyle")
            {
                Property = GlobalCalendar.CalendarItemStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new Style[] { new Style { TargetType = typeof(GlobalCalendarItem) }, new Style { TargetType = typeof(Control) } },
                InvalidValues = new Dictionary<Style, Type> { { new Style { TargetType = typeof(CalendarItem) }, typeof(ArgumentException) } }
            };
            IsTodayHighlightedProperty = new DependencyPropertyTest<GlobalCalendar, bool>(this, "IsTodayHighlighted")
            {
                Property = GlobalCalendar.IsTodayHighlightedProperty,
                Initializer = initializer,
                DefaultValue = true,
                OtherValues = new bool[] { false },
                InvalidValues = new Dictionary<bool, Type> { }
            };
            DisplayModeProperty = new DependencyPropertyTest<GlobalCalendar, CalendarMode>(this, "DisplayMode")
            {
                Property = GlobalCalendar.DisplayModeProperty,
                Initializer = initializer,
                DefaultValue = CalendarMode.Month,
                OtherValues = new CalendarMode[] { CalendarMode.Decade, CalendarMode.Year },
                InvalidValues = new Dictionary<CalendarMode, Type>
                    {
                        { (CalendarMode)(-1), typeof(ArgumentException) },
                        { (CalendarMode)3, typeof(ArgumentException) },
                        { (CalendarMode)100, typeof(ArgumentException) }
                    }
            };
            FirstDayOfWeekProperty = new DependencyPropertyTest<GlobalCalendar, DayOfWeek>(this, "FirstDayOfWeek")
            {
                Property = GlobalCalendar.FirstDayOfWeekProperty,
                Initializer = initializer,
                DefaultValue = DayOfWeek.Sunday,
                OtherValues = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday },
                InvalidValues = new Dictionary<DayOfWeek, Type>
                    {
                        { (DayOfWeek)(-1), typeof(ArgumentOutOfRangeException) },
                        { (DayOfWeek)7, typeof(ArgumentOutOfRangeException) },
                        { (DayOfWeek)100, typeof(ArgumentOutOfRangeException) }
                    }
            };
            SelectionModeProperty = new DependencyPropertyTest<GlobalCalendar, CalendarSelectionMode>(this, "SelectionMode")
            {
                Property = GlobalCalendar.SelectionModeProperty,
                Initializer = initializer,
                DefaultValue = CalendarSelectionMode.SingleDate,
                OtherValues = new CalendarSelectionMode[] { CalendarSelectionMode.MultipleRange, CalendarSelectionMode.None, CalendarSelectionMode.SingleRange },
                InvalidValues = new Dictionary<CalendarSelectionMode, Type>
                    {
                        { (CalendarSelectionMode)(-1), typeof(ArgumentOutOfRangeException) },
                        { (CalendarSelectionMode)4, typeof(ArgumentOutOfRangeException) },
                        { (CalendarSelectionMode)100, typeof(ArgumentOutOfRangeException) }
                    }
            };
            SelectedDateProperty = new DependencyPropertyTest<GlobalCalendar, DateTime?>(this, "SelectedDate")
            {
                Property = GlobalCalendar.SelectedDateProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new DateTime?[] { DateTime.Today, DateTime.Today.AddDays(7), DateTime.Today.AddDays(-7) },
                InvalidValues = new Dictionary<DateTime?, Type> { }
            };
            DisplayDateProperty = new DependencyPropertyTest<GlobalCalendar, DateTime>(this, "DisplayDate")
            {
                Property = GlobalCalendar.DisplayDateProperty,
                Initializer = initializer,
                DefaultValue = DateTime.Today,
                OtherValues = new DateTime[] { DateTime.Today.AddDays(31), DateTime.Today.AddDays(-31) },
                InvalidValues = new Dictionary<DateTime, Type> { }
            };
            DisplayDateStartProperty = new DependencyPropertyTest<GlobalCalendar, DateTime?>(this, "DisplayDateStart")
            {
                Property = GlobalCalendar.DisplayDateStartProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new DateTime?[] { DateTime.Today, DateTime.Today.AddDays(31), DateTime.Today.AddDays(-31) },
                InvalidValues = new Dictionary<DateTime?, Type> { }
            };
            DisplayDateEndProperty = new DependencyPropertyTest<GlobalCalendar, DateTime?>(this, "DisplayDateEnd")
            {
                Property = GlobalCalendar.DisplayDateEndProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new DateTime?[] { DateTime.Today, DateTime.Today.AddDays(31), DateTime.Today.AddDays(-31) },
                InvalidValues = new Dictionary<DateTime?, Type> { }
            };
            CalendarDayButtonStyleSelectorProperty = new DependencyPropertyTest<GlobalCalendar, CalendarDayButtonStyleSelector>(this, "CalendarDayButtonStyleSelector")
            {
                Property = GlobalCalendar.CalendarDayButtonStyleSelectorProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new CalendarDayButtonStyleSelector[] { null },
                InvalidValues = new Dictionary<CalendarDayButtonStyleSelector, Type> { }
            };
            CalendarInfoProperty = new DependencyPropertyTest<GlobalCalendar, CalendarInfo>(this, "CalendarInfo")
            {
                Property = GlobalCalendar.CalendarInfoProperty,
                Initializer = initializer,
                DefaultValue = new GregorianCalendarInfo(CultureInfo.CurrentCulture),
                OtherValues = new CalendarInfo[] { new CultureCalendarInfo(new CultureInfo("en-US")), new CultureCalendarInfo(new CultureInfo("th-TH")) },
                InvalidValues = new Dictionary<CalendarInfo, Type> { }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TimePickerPopupBaseTest"/> class.
        /// </summary>
        protected TimePickerPopupBaseTest()
        {
            Func <TimePickerPopup> initializer = () => DefaultTimePickerPopupToTest;

            ValueProperty = new DependencyPropertyTest <TimePickerPopup, DateTime?>(this, "Value")
            {
                Property     = TimePickerPopup.ValueProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MinimumProperty = new DependencyPropertyTest <TimePickerPopup, DateTime?>(this, "Minimum")
            {
                Property     = TimePickerPopup.MinimumProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MaximumProperty = new DependencyPropertyTest <TimePickerPopup, DateTime?>(this, "Maximum")
            {
                Property     = TimePickerPopup.MaximumProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            FormatProperty = new DependencyPropertyTest <TimePickerPopup, ITimeFormat>(this, "Format")
            {
                Property     = TimePickerPopup.FormatProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new ITimeFormat[] { new ShortTimeFormat(), new LongTimeFormat(), new CustomTimeFormat("hh:ss") },
            };

            CultureProperty = new DependencyPropertyTest <TimePickerPopup, CultureInfo>(this, "Culture")
            {
                Property     = TimePickerPopup.CultureProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new CultureInfo("en-US"), new CultureInfo("nl-NL") }
            };

            TimeGlobalizationInfoProperty = new DependencyPropertyTest <TimePickerPopup, TimeGlobalizationInfo>(this, "TimeGlobalizationInfo")
            {
                Property     = TimePickerPopup.TimeGlobalizationInfoProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[] { new TimeGlobalizationInfo() }
            };

            PopupSecondsIntervalProperty = new DependencyPropertyTest <TimePickerPopup, int>(this, "PopupSecondsInterval")
            {
                Property      = TimePickerPopup.PopupSecondsIntervalProperty,
                Initializer   = initializer,
                DefaultValue  = 0,
                OtherValues   = new[] { 10, 20, 59 },
                InvalidValues = new Dictionary <int, Type>()
                {
                    { -10, typeof(ArgumentOutOfRangeException) },
                    { -1, typeof(ArgumentOutOfRangeException) },
                    { -21311, typeof(ArgumentOutOfRangeException) },
                }
            };

            PopupMinutesIntervalProperty = new DependencyPropertyTest <TimePickerPopup, int>(this, "PopupMinutesInterval")
            {
                Property      = TimePickerPopup.PopupMinutesIntervalProperty,
                Initializer   = initializer,
                DefaultValue  = 30,
                OtherValues   = new[] { 10, 20, 59 },
                InvalidValues = new Dictionary <int, Type>()
                {
                    { -10, typeof(ArgumentOutOfRangeException) },
                    { -1, typeof(ArgumentOutOfRangeException) },
                    { -21311, typeof(ArgumentOutOfRangeException) },
                }
            };
            // todo: the enum values that are commented out will be included after mix.
            PopupTimeSelectionModeProperty = new DependencyPropertyTest <TimePickerPopup, PopupTimeSelectionMode>(this, "PopupTimeSelectionMode")
            {
                Property     = TimePickerPopup.PopupTimeSelectionModeProperty,
                Initializer  = initializer,
                DefaultValue = PopupTimeSelectionMode.HoursAndMinutesOnly,
                // OtherValues = new[] { PopupTimeSelectionMode.AllowTimeDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsAndDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsSelection },
                InvalidValues = new Dictionary <PopupTimeSelectionMode, Type>()
                {
                    { (PopupTimeSelectionMode)12, typeof(ArgumentOutOfRangeException) },
                    { (PopupTimeSelectionMode)23, typeof(ArgumentOutOfRangeException) },
                    { (PopupTimeSelectionMode)66, typeof(ArgumentOutOfRangeException) },
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the TreeViewTest class.
        /// </summary>
        public TreeViewTest()
            : base()
        {
            BackgroundProperty.DefaultValue = new SolidColorBrush(Colors.White);
            BorderBrushProperty.DefaultValue = new SolidColorBrush(Colors.Black);
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue = new Thickness(1);

            Func<TreeView> initializer = () => DefaultTreeViewToTest;
            SelectedItemProperty = new DependencyPropertyTest<TreeView, object>(this, "SelectedItem")
                {
                    Property = TreeView.SelectedItemProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new object[] { new object() }
                };
            SelectedValueProperty = new DependencyPropertyTest<TreeView, object>(this, "SelectedValue")
                {
                    Property = TreeView.SelectedValueProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new object[] { new object() }
                };
            SelectedValuePathProperty = new DependencyPropertyTest<TreeView, string>(this, "SelectedValuePath")
                {
                    Property = TreeView.SelectedValuePathProperty,
                    Initializer = initializer,
                    DefaultValue = "",
                    OtherValues = new string[] { "Value", null }
                };
            ItemContainerStyleProperty = new DependencyPropertyTest<TreeView, Style>(this, "ItemContainerStyle")
                {
                    Property = TreeView.ItemContainerStyleProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new Style[] { new Style(typeof(HeaderedItemsControl)), new Style(typeof(ItemsControl)), new Style(typeof(Control)) }
                };

            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
        }
 /// <summary>
 /// Initializes a new instance of the BusyIndicatorTest class.
 /// </summary>
 public BusyIndicatorTest()
     : base()
 {
     IsBusyProperty = new DependencyPropertyTest<BusyIndicator, bool>(this, "IsBusy")
     {
         Property = BusyIndicator.IsBusyProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = false,
         OtherValues = new bool[] { false },
     };
     BusyContentProperty = new DependencyPropertyTest<BusyIndicator, object>(this, "BusyContent")
     {
         Property = BusyIndicator.BusyContentProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = "Please wait...",
         OtherValues = new object[] { 12, "Test Text", Environment.OSVersion },
     };
     BusyContentTemplateProperty = new DependencyPropertyTest<BusyIndicator, DataTemplate>(this, "BusyContentTemplate")
     {
         Property = BusyIndicator.BusyContentTemplateProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues = new DataTemplate[]
         {
             new DataTemplate(),
             new XamlBuilder<DataTemplate>().Load(),
             (new XamlBuilder<DataTemplate> { Name = "Template" }).Load(),
             (new XamlBuilder<DataTemplate> { Name = "Template", Children = new List<XamlBuilder> { new XamlBuilder<StackPanel>() } }).Load()
         }
     };
     DisplayAfterProperty = new DependencyPropertyTest<BusyIndicator, TimeSpan>(this, "DisplayAfter")
     {
         Property = BusyIndicator.DisplayAfterProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = TimeSpan.FromSeconds(0.1),
         OtherValues = new TimeSpan[] { TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(1) },
     };
     OverlayStyleProperty = new DependencyPropertyTest<BusyIndicator, Style>(this, "OverlayStyle")
     {
         Property = BusyIndicator.OverlayStyleProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues = new Style[] { new Style { TargetType = typeof(Rectangle) } },
     };
     ProgressBarStyleProperty = new DependencyPropertyTest<BusyIndicator, Style>(this, "ProgressBarStyle")
     {
         Property = BusyIndicator.ProgressBarStyleProperty,
         Initializer = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues = new Style[] { new Style { TargetType = typeof(ProgressBar) } },
     };
 }
Ejemplo n.º 34
0
        /// <summary>
        /// Initializes a new instance of the ControlTest class.
        /// </summary>
        protected ControlTest()
        {
            Func<Control> initializer = () => DefaultControlToTest;

            BackgroundProperty = new DependencyPropertyTest<Control, Brush>(this, "Background")
                {
                    Property = Control.BackgroundProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new Brush[] { new SolidColorBrush(Colors.Black), new SolidColorBrush(Colors.Red) }
                };
            BorderBrushProperty = new DependencyPropertyTest<Control, Brush>(this, "BorderBrush")
                {
                    Property = Control.BorderBrushProperty,
                    Initializer = () => { Control c = DefaultControlToTest; c.BorderThickness = new Thickness(2.0); return c; },
                    DefaultValue = null,
                    OtherValues = new Brush[] { new SolidColorBrush(Colors.Black), new SolidColorBrush(Colors.Red) }
                };
            BorderThicknessProperty = new DependencyPropertyTest<Control, Thickness>(this, "BorderThickness")
                {
                    Property = Control.BorderThicknessProperty,
                    Initializer = () => { Control c = DefaultControlToTest; c.BorderBrush = new SolidColorBrush(Colors.Black); return c; },
                    DefaultValue = new Thickness(0.0),
                    OtherValues = new Thickness[] { new Thickness(2.0), new Thickness(10.0), new Thickness(0.0), new Thickness(.5), new Thickness(1, 2, 3, 4) },
                    InvalidValues = new Dictionary<Thickness, Type>
                    {
                        { new Thickness(-1), typeof(InvalidOperationException) }
                    }
                };
            FontFamilyProperty = new DependencyPropertyTest<Control, FontFamily>(this, "FontFamily")
                {
                    Property = Control.FontFamilyProperty,
                    Initializer = initializer,
                    DefaultValue = new FontFamily("Portable User Interface"),
                    OtherValues = new FontFamily[] { new FontFamily("Verdana"), new FontFamily("Courier"), new FontFamily("Times New Roman"), new FontFamily("Trebuchet MS") }
                };
            FontSizeProperty = new DependencyPropertyTest<Control, double>(this, "FontSize")
                {
                    Property = Control.FontSizeProperty,
                    Initializer = initializer,
                    DefaultValue = 11.0,
                    OtherValues = new double[] { 14.666666984558105, 14.0, 5.0, 0.0, 20.0 },
                    InvalidValues = new Dictionary<double, Type>
                    {
                        { -1.0, typeof(ArgumentException) },
                        { double.NaN, typeof(ArgumentException) },
                        { double.PositiveInfinity, typeof(ArgumentException) },
                        { double.NegativeInfinity, typeof(ArgumentException) },
                    }
                };
            FontStretchProperty = new DependencyPropertyTest<Control, FontStretch>(this, "FontStretch")
                {
                    Property = Control.FontStretchProperty,
                    Initializer = initializer,
                    DefaultValue = FontStretches.Normal,
                    OtherValues = new FontStretch[] { FontStretches.Condensed, FontStretches.Expanded, FontStretches.UltraExpanded }
                };
            FontStyleProperty = new DependencyPropertyTest<Control, FontStyle>(this, "FontStyle")
                {
                    Property = Control.FontStyleProperty,
                    Initializer = initializer,
                    DefaultValue = FontStyles.Normal,
                    OtherValues = new FontStyle[] { FontStyles.Italic }
                };
            FontWeightProperty = new DependencyPropertyTest<Control, FontWeight>(this, "FontWeight")
                {
                    Property = Control.FontWeightProperty,
                    Initializer = initializer,
                    DefaultValue = FontWeights.Normal,
                    OtherValues = new FontWeight[] { FontWeights.Bold, FontWeights.Thin, FontWeights.ExtraBold, FontWeights.Black, FontWeights.Light }
                };
            ForegroundProperty = new DependencyPropertyTest<Control, Brush>(this, "Foreground")
                {
                    Property = Control.ForegroundProperty,
                    Initializer = initializer,
                    DefaultValue = new SolidColorBrush(Colors.Black),
                    OtherValues = new Brush[] { new SolidColorBrush(Colors.Red), null, new SolidColorBrush(Colors.Blue) }
                };
            HorizontalContentAlignmentProperty = new DependencyPropertyTest<Control, HorizontalAlignment>(this, "HorizontalContentAlignment")
                {
                    Property = Control.HorizontalContentAlignmentProperty,
                    Initializer = initializer,
                    DefaultValue = HorizontalAlignment.Center,
                    OtherValues = new HorizontalAlignment[] { HorizontalAlignment.Right, HorizontalAlignment.Center, HorizontalAlignment.Stretch },
                    InvalidValues = new Dictionary<HorizontalAlignment, Type>
                    {
                        { (HorizontalAlignment)(-1), typeof(OverflowException) },
                        { (HorizontalAlignment)4, typeof(ArgumentException) },
                        { (HorizontalAlignment)10, typeof(ArgumentException) },
                        { (HorizontalAlignment)27, typeof(ArgumentException) },
                        { (HorizontalAlignment)int.MaxValue, typeof(OverflowException) },
                        { (HorizontalAlignment)int.MinValue, typeof(OverflowException) }
                    }
                };
            IsEnabledProperty = new DependencyPropertyTest<Control, bool>(this, "IsEnabled")
                {
                    Property = Control.IsEnabledProperty,
                    Initializer = initializer,
                    DefaultValue = true,
                    OtherValues = new bool[] { false }
                };
            PaddingProperty = new DependencyPropertyTest<Control, Thickness>(this, "Padding")
                {
                    Property = Control.PaddingProperty,
                    Initializer = initializer,
                    DefaultValue = new Thickness(0.0),
                    OtherValues = new Thickness[] { new Thickness(2.0), new Thickness(10.0), new Thickness(.5), new Thickness(1, 2, 3, 4) },
                    InvalidValues = new Dictionary<Thickness, Type>
                    {
                        { new Thickness(-1), typeof(InvalidOperationException) }
                    }
                };
            VerticalContentAlignmentProperty = new DependencyPropertyTest<Control, VerticalAlignment>(this, "VerticalContentAlignment")
                {
                    Property = Control.VerticalContentAlignmentProperty,
                    Initializer = initializer,
                    DefaultValue = VerticalAlignment.Center,
                    OtherValues = new VerticalAlignment[] { VerticalAlignment.Top, VerticalAlignment.Bottom, VerticalAlignment.Stretch },
                    InvalidValues = new Dictionary<VerticalAlignment, Type>
                    {
                        { (VerticalAlignment)(-1), typeof(OverflowException) },
                        { (VerticalAlignment)4, typeof(ArgumentException) },
                        { (VerticalAlignment)10, typeof(ArgumentException) },
                        { (VerticalAlignment)27, typeof(ArgumentException) },
                        { (VerticalAlignment)int.MaxValue, typeof(OverflowException) },
                        { (VerticalAlignment)int.MinValue, typeof(OverflowException) }
                    }
                };
        }
 /// <summary>
 /// Initializes a new instance of the DockPanelTest class.
 /// </summary>
 public DockPanelTest()
     : base()
 {
     Func<DockPanel> initializer = () => DefaultDockPanelToTest;
     DockProperty = new DependencyPropertyTest<DockPanel, Dock>(this, "Dock")
         {
             Property = DockPanel.DockProperty,
             Initializer = initializer,
             IsAttached = true,
             AttachedInitializer = () => new Button { Content = "Test" },
             DefaultValue = Dock.Left,
             OtherValues = new Dock[] { Dock.Top, Dock.Right, Dock.Bottom },
             InvalidValues = new Dictionary<Dock, Type>
             {
                 { (Dock)(-1), typeof(ArgumentException) },
                 { (Dock)4, typeof(ArgumentException) },
                 { (Dock)10, typeof(ArgumentException) },
                 { (Dock)27, typeof(ArgumentException) },
                 { (Dock)int.MaxValue, typeof(ArgumentException) },
                 { (Dock)int.MinValue, typeof(ArgumentException) }
             }
         };
     LastChildFillProperty = new DependencyPropertyTest<DockPanel, bool>(this, "LastChildFill")
         {
             Property = DockPanel.LastChildFillProperty,
             Initializer = initializer,
             DefaultValue = true,
             OtherValues = new bool[] { false }
         };
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DomainUpDownTest"/> class.
        /// </summary>
        public DomainUpDownTest()
        {
            Func <DomainUpDown> initializer = () => DefaultDomainUpDownToTest;
            Func <DomainUpDown> initializerWithItemsSource = () =>
            {
                DomainUpDown dud = DefaultDomainUpDownToTest;
                dud.ItemsSource = new object[] { 1, 2, 3, 4 };
                return(dud);
            };

            ItemsSourceProperty =
                new DependencyPropertyTest <DomainUpDown, IEnumerable>(this, "ItemsSource")
            {
                Property     = DomainUpDown.ItemsSourceProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new List <IEnumerable>()
                {
                    new object[]
                    {
                        new Rectangle(),
                        "test string"
                    },
                    null
                }
            };

            CurrentIndexProperty =
                new DependencyPropertyTest <DomainUpDown, int>(this, "CurrentIndex")
            {
                Property     = DomainUpDown.CurrentIndexProperty,
                Initializer  = initializerWithItemsSource,
                DefaultValue = 0,           // since we have an items collection, default value is not valid and is coerced
                OtherValues  = new int[] { 1, 2 }
            };

            IsCyclicProperty =
                new DependencyPropertyTest <DomainUpDown, bool>(this, "IsCyclic")
            {
                Property     = DomainUpDown.IsCyclicProperty,
                Initializer  = initializer,
                DefaultValue = false,
                OtherValues  = new bool[] { true }
            };

            ItemTemplateProperty =
                new DependencyPropertyTest <DomainUpDown, DataTemplate>(this, "ItemTemplate")
            {
                Property     = DomainUpDown.ItemTemplateProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new[]
                {
                    new DataTemplate(),
                    new XamlBuilder <DataTemplate>().Load(),
                    (new XamlBuilder <DataTemplate> {
                        Name = "Template"
                    }).Load(),
                    (new XamlBuilder <DataTemplate> {
                        Name = "Template", Children = new List <XamlBuilder> {
                            new XamlBuilder <StackPanel>()
                        }
                    }).Load()
                }
            };

            AcceptsInvalidInputProperty =
                new DependencyPropertyTest <DomainUpDown, InvalidInputAction>(this, "InvalidInputAction")
            {
                Property     = DomainUpDown.InvalidInputActionProperty,
                Initializer  = initializer,
                DefaultValue = InvalidInputAction.UseFallbackItem,
                OtherValues  = new[] { InvalidInputAction.TextBoxCannotLoseFocus, }
            };

            FallbackItemProperty =
                new DependencyPropertyTest <DomainUpDown, object>(this, "FallbackItem")
            {
                Property     = DomainUpDown.FallbackItemProperty,
                Initializer  = initializerWithItemsSource,
                DefaultValue = null,
                OtherValues  = new object[] { 1, 2, 3, 4 }
            };

            // setting new defaults
            BorderBrushProperty.DefaultValue = new LinearGradientBrush()
            {
                StartPoint    = new Point(0.5, 0),
                EndPoint      = new Point(0.5, 1),
                GradientStops = new GradientStopCollection
                {
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0xA3, 0xAE, 0xB9), Offset = 0
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x83, 0x99, 0xA9), Offset = 0.375
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x71, 0x85, 0x97), Offset = 0.375
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x61, 0x75, 0x84), Offset = 1
                    },
                }
            };

            BackgroundProperty.DefaultValue = new SolidColorBrush(Colors.Transparent);

            BorderThicknessProperty.DefaultValue = new Thickness(1);

            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;

            PaddingProperty.DefaultValue = new Thickness(0);

            Func <UpDownBase <object> > initializerWithItemsSourceUpDownBase = () =>
            {
                DomainUpDown dud = DefaultDomainUpDownToTest;
                dud.ItemsSource = new object[] { 1, 2, 3, 4 };
                return(dud);
            };

            ValueProperty.Initializer  = initializerWithItemsSourceUpDownBase;
            ValueProperty.DefaultValue = 1;
            ValueProperty.OtherValues  = new object[] { 1, 2 };
        }
Ejemplo n.º 37
0
        /// <summary>
        /// Initializes a new instance of the 
        /// <see cref="ClipperTest"/> class.
        /// </summary>
        protected ClipperTest()
        {
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;

            Func<Clipper> initializer = () => DefaultClipperToTest;

            RatioVisibleProperty = new DependencyPropertyTest<Clipper, double>(this, "RatioVisible")
                                     {
                                         Property = Clipper.RatioVisibleProperty,
                                         Initializer = initializer,
                                         DefaultValue = 1.0,
                                         OtherValues = new[] { 0.0 }
                                     };
        }
        public TimePickerTest()
        {
            LinearGradientBrush brush = new LinearGradientBrush
            {
                StartPoint = new Point(0.5, 0.0),
                EndPoint = new Point(0.5, 1.0)
            };
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0xA3, 0xAE, 0xB9),
                    Offset = 0.0
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x83, 0x99, 0xA9),
                    Offset = 0.375
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x71, 0x85, 0x97),
                    Offset = 0.375
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x61, 0x75, 0x84),
                    Offset = 1.0
                });
            BorderBrushProperty.DefaultValue = brush;
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            BackgroundProperty.DefaultValue = new SolidColorBrush(Colors.Transparent);

            Func<TimePicker> initializer = () => DefaultTimePickerToTest;

            ValueProperty = new DependencyPropertyTest<TimePicker, DateTime?>(this, "Value")
            {
                Property = TimePicker.ValueProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MinimumProperty = new DependencyPropertyTest<TimePicker, DateTime?>(this, "Minimum")
            {
                Property = TimePicker.MinimumProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MaximumProperty = new DependencyPropertyTest<TimePicker, DateTime?>(this, "Maximum")
            {
                Property = TimePicker.MaximumProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            TimeUpDownStyleProperty = new DependencyPropertyTest<TimePicker, Style>(this, "TimeUpDownStyle")
            {
                Property = TimePicker.TimeUpDownStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new Style(typeof(TimeUpDown)) }
            };

            SpinnerStyleProperty = new DependencyPropertyTest<TimePicker, Style>(this, "SpinnerStyle")
            {
                Property = TimePicker.SpinnerStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new Style(typeof(ButtonSpinner)), new Style(typeof(Control)) }
            };

            TimeParsersProperty = new DependencyPropertyTest<TimePicker, TimeParserCollection>(this, "TimeParsers")
            {
                Property = TimePicker.TimeParsersProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new TimeParserCollection(), null }
            };

            FormatProperty = new DependencyPropertyTest<TimePicker, ITimeFormat>(this, "Format")
            {
                Property = TimePicker.FormatProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new ITimeFormat[] { new ShortTimeFormat(), new LongTimeFormat(), new CustomTimeFormat("hh:ss") },
            };

            CultureProperty = new DependencyPropertyTest<TimePicker, CultureInfo>(this, "Culture")
            {
                Property = TimePicker.CultureProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new CultureInfo("en-US"), new CultureInfo("nl-NL") }
            };

            TimeGlobalizationInfoProperty = new DependencyPropertyTest<TimePicker, TimeGlobalizationInfo>(this, "TimeGlobalizationInfo")
            {
                Property = TimePicker.TimeGlobalizationInfoProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new TimeGlobalizationInfo() }
            };

            PopupSecondsIntervalProperty = new DependencyPropertyTest<TimePicker, int>(this, "PopupSecondsInterval")
            {
                Property = TimePicker.PopupSecondsIntervalProperty,
                Initializer = initializer,
                DefaultValue = default(int),
                OtherValues = new[] { 1, 2, 30 },
                InvalidValues = new Dictionary<int, Type>()
                                    {
                                        { -10, typeof(ArgumentOutOfRangeException) },
                                        { -1, typeof(ArgumentOutOfRangeException) },
                                        { 60, typeof(ArgumentOutOfRangeException) },
                                        { 2360, typeof(ArgumentOutOfRangeException) },
                                        { -21311, typeof(ArgumentOutOfRangeException) },
                                    }
            };

            PopupMinutesIntervalProperty = new DependencyPropertyTest<TimePicker, int>(this, "PopupMinutesInterval")
            {
                Property = TimePicker.PopupMinutesIntervalProperty,
                Initializer = initializer,
                DefaultValue = default(int),
                OtherValues = new[] { 1, 2, 30 },
                InvalidValues = new Dictionary<int, Type>()
                                    {
                                        { -10, typeof(ArgumentOutOfRangeException) },
                                        { -1, typeof(ArgumentOutOfRangeException) },
                                        { 60, typeof(ArgumentOutOfRangeException) },
                                        { 12344, typeof(ArgumentOutOfRangeException) },
                                        { -21311, typeof(ArgumentOutOfRangeException) },
                                    }
            };

            // todo: the enum values that are commented out will be included after mix.
            PopupTimeSelectionModeProperty = new DependencyPropertyTest<TimePicker, PopupTimeSelectionMode>(this, "PopupTimeSelectionMode")
            {
                Property = TimePicker.PopupTimeSelectionModeProperty,
                Initializer = initializer,
                DefaultValue = PopupTimeSelectionMode.HoursAndMinutesOnly,
                // OtherValues = new[] { PopupTimeSelectionMode.AllowTimeDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsAndDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsSelection },
                InvalidValues = new Dictionary<PopupTimeSelectionMode, Type>()
                                    {
                                        { (PopupTimeSelectionMode)12, typeof(ArgumentOutOfRangeException) },
                                        { (PopupTimeSelectionMode)23, typeof(ArgumentOutOfRangeException) },
                                        { (PopupTimeSelectionMode)66, typeof(ArgumentOutOfRangeException) },
                                    }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TimePickerPopupBaseTest"/> class.
        /// </summary>
        protected TimePickerPopupBaseTest()
        {
            Func<TimePickerPopup> initializer = () => DefaultTimePickerPopupToTest;

            ValueProperty = new DependencyPropertyTest<TimePickerPopup, DateTime?>(this, "Value")
            {
                Property = TimePickerPopup.ValueProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MinimumProperty = new DependencyPropertyTest<TimePickerPopup, DateTime?>(this, "Minimum")
            {
                Property = TimePickerPopup.MinimumProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            MaximumProperty = new DependencyPropertyTest<TimePickerPopup, DateTime?>(this, "Maximum")
            {
                Property = TimePickerPopup.MaximumProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new DateTime?(), new DateTime(2000, 12, 3), new DateTime(1900, 1, 1) },
            };

            FormatProperty = new DependencyPropertyTest<TimePickerPopup, ITimeFormat>(this, "Format")
            {
                Property = TimePickerPopup.FormatProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new ITimeFormat[] { new ShortTimeFormat(), new LongTimeFormat(), new CustomTimeFormat("hh:ss") },
            };

            CultureProperty = new DependencyPropertyTest<TimePickerPopup, CultureInfo>(this, "Culture")
            {
                Property = TimePickerPopup.CultureProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new CultureInfo("en-US"), new CultureInfo("nl-NL") }
            };

            TimeGlobalizationInfoProperty = new DependencyPropertyTest<TimePickerPopup, TimeGlobalizationInfo>(this, "TimeGlobalizationInfo")
            {
                Property = TimePickerPopup.TimeGlobalizationInfoProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new TimeGlobalizationInfo() }
            };

            PopupSecondsIntervalProperty = new DependencyPropertyTest<TimePickerPopup, int>(this, "PopupSecondsInterval")
            {
                Property = TimePickerPopup.PopupSecondsIntervalProperty,
                Initializer = initializer,
                DefaultValue = 0,
                OtherValues = new[] { 10, 20, 59 },
                InvalidValues = new Dictionary<int, Type>()
                                    {
                                        { -10, typeof(ArgumentOutOfRangeException) },
                                        { -1, typeof(ArgumentOutOfRangeException) },
                                        { -21311, typeof(ArgumentOutOfRangeException) },
                                    }
            };

            PopupMinutesIntervalProperty = new DependencyPropertyTest<TimePickerPopup, int>(this, "PopupMinutesInterval")
            {
                Property = TimePickerPopup.PopupMinutesIntervalProperty,
                Initializer = initializer,
                DefaultValue = 30,
                OtherValues = new[] { 10, 20, 59 },
                InvalidValues = new Dictionary<int, Type>()
                                    {
                                        { -10, typeof(ArgumentOutOfRangeException) },
                                        { -1, typeof(ArgumentOutOfRangeException) },
                                        { -21311, typeof(ArgumentOutOfRangeException) },
                                    }
            };
            // todo: the enum values that are commented out will be included after mix.
            PopupTimeSelectionModeProperty = new DependencyPropertyTest<TimePickerPopup, PopupTimeSelectionMode>(this, "PopupTimeSelectionMode")
            {
                Property = TimePickerPopup.PopupTimeSelectionModeProperty,
                Initializer = initializer,
                DefaultValue = PopupTimeSelectionMode.HoursAndMinutesOnly,
                // OtherValues = new[] { PopupTimeSelectionMode.AllowTimeDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsAndDesignatorsSelection, PopupTimeSelectionMode.AllowSecondsSelection },
                InvalidValues = new Dictionary<PopupTimeSelectionMode, Type>()
                                    {
                                        { (PopupTimeSelectionMode)12, typeof(ArgumentOutOfRangeException) },
                                        { (PopupTimeSelectionMode)23, typeof(ArgumentOutOfRangeException) },
                                        { (PopupTimeSelectionMode)66, typeof(ArgumentOutOfRangeException) },
                                    }
            };
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Initializes a new instance of the ViewboxTest class.
        /// </summary>
        public ViewboxTest()
            : base()
        {
            Func<Viewbox> initializer = () => DefaultViewboxToTest;

            StretchProperty = new DependencyPropertyTest<Viewbox, Stretch>(this, "Stretch")
            {
                Property = Viewbox.StretchProperty,
                Initializer = initializer,
                DefaultValue = Stretch.Uniform,
                OtherValues = new Stretch[] { Stretch.None, Stretch.Fill, Stretch.UniformToFill },
                InvalidValues = new Dictionary<Stretch, Type>
                {
                    { (Stretch)(-1), typeof(ArgumentException) },
                    { (Stretch)4, typeof(ArgumentException) },
                    { (Stretch)5, typeof(ArgumentException) },
                    { (Stretch)500, typeof(ArgumentException) },
                    { (Stretch)int.MaxValue, typeof(ArgumentException) },
                    { (Stretch)int.MinValue, typeof(ArgumentException) }
                }
            };

            StretchDirectionProperty = new DependencyPropertyTest<Viewbox, StretchDirection>(this, "StretchDirection")
            {
                Property = Viewbox.StretchDirectionProperty,
                Initializer = initializer,
                DefaultValue = StretchDirection.Both,
                OtherValues = new StretchDirection[] { StretchDirection.DownOnly, StretchDirection.UpOnly },
                InvalidValues = new Dictionary<StretchDirection, Type>
                {
                    { (StretchDirection)(-1), typeof(ArgumentException) },
                    { (StretchDirection)3, typeof(ArgumentException) },
                    { (StretchDirection)4, typeof(ArgumentException) },
                    { (StretchDirection)500, typeof(ArgumentException) },
                    { (StretchDirection)int.MaxValue, typeof(ArgumentException) },
                    { (StretchDirection)int.MinValue, typeof(ArgumentException) }
                }
            };
        }
Ejemplo n.º 41
0
        public RatingTest()
        {
            Func<Rating> initializer = () => new Rating();
            
            SelectionModeProperty = 
                new DependencyPropertyTest<Rating, RatingSelectionMode>(this, "SelectionMode")
                {
                     Property = Rating.SelectionModeProperty,
                     Initializer = initializer,
                     DefaultValue = RatingSelectionMode.Continuous,
                     OtherValues = 
                        new[]
                        { 
                            RatingSelectionMode.Individual
                        },
                     InvalidValues = 
                        new Dictionary<RatingSelectionMode, Type>
                        {
                            { (RatingSelectionMode)99, typeof(ArgumentOutOfRangeException) },
                            { (RatingSelectionMode)66, typeof(ArgumentOutOfRangeException) }
                        }
                };

            ItemContainerStyleProperty = 
                new DependencyPropertyTest<Rating, Style>(this, "ItemContainerStyle")
                {
                    Property = Rating.ItemContainerStyleProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = 
                        new[] 
                        {
                            new Style(typeof(HeaderedItemsControl)), 
                            new Style(typeof(ItemsControl)), 
                            new Style(typeof(Control)) 
                        }
                };
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Initializes a new instance of the TreeMapTest class.
        /// </summary>
        public TreeMapTest()
            : base()
        {
            Func<TreeMap> initializer = () => DefaultTreeMapToTest;
            TreeMapItemDefinitionSelectorProperty = new DependencyPropertyTest<TreeMap, TreeMapItemDefinitionSelector>(this, "TreeMapItemDefinitionSelector")
            {
                Property = TreeMap.ItemDefinitionSelectorProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new[] { new OverriddenTreeMapItemDefinitionSelector() }
            };
            ItemDefinitionProperty = new DependencyPropertyTest<TreeMap, TreeMapItemDefinition>(this, "ItemDefinition")
            {
                Property = TreeMap.ItemDefinitionProperty,
                Initializer = initializer,
                OtherValues = new TreeMapItemDefinition[] { new TreeMapItemDefinition() }
            };

            ItemsSourceProperty = new DependencyPropertyTest<TreeMap, IEnumerable>(this, "ItemsSource")
            {
                Property = TreeMap.ItemsSourceProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new IList[] { new string[] { }, null }
                // OtherValues = new IList[] { new string[] { "hello", "world" }, null } - not used as ItemDefinition must be set
            };

            InterpolatorsProperty = new DependencyPropertyTest<TreeMap, IList>(this, "Interpolators")
            {
                Property = TreeMap.InterpolatorsProperty,
                Initializer = initializer,
                DefaultValue = new ObservableCollection<Interpolator>(),
                OtherValues = new IList[] { new List<Interpolator>() { } }
            };
        }
        /// <summary>
        /// Initializes a new instance of the NumericUpDownTest class.
        /// </summary>
        public NumericUpDownTest()
            : base()
        {
            // carefully construct DP tests below to avoid coercion
            Func <NumericUpDown> initializer = () => DefaultNumericUpDownToTest;

            BorderThicknessProperty.DefaultValue = new Thickness(1);

            BorderBrushProperty.DefaultValue = new LinearGradientBrush()
            {
                StartPoint    = new Point(0.5, 0),
                EndPoint      = new Point(0.5, 1),
                GradientStops = new GradientStopCollection
                {
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0xA3, 0xAE, 0xB9), Offset = 0
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x83, 0x99, 0xA9), Offset = 0.375
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x71, 0x85, 0x97), Offset = 0.375
                    },
                    new GradientStop {
                        Color = Color.FromArgb(0xFF, 0x61, 0x75, 0x84), Offset = 1
                    },
                }
            };

            ValueProperty.OtherValues   = new double[] { 1, 99 };
            ValueProperty.InvalidValues = new Dictionary <double, Type>
            {
                { double.NaN, typeof(ArgumentException) },
                { double.NegativeInfinity, typeof(ArgumentException) },
                { double.PositiveInfinity, typeof(ArgumentException) },
                { (double)double.MinValue - 1, typeof(ArgumentException) },
                { (double)double.MaxValue + 1, typeof(ArgumentException) },
            };

            MinimumProperty = new DependencyPropertyTest <NumericUpDown, double>(this, "Minimum")
            {
                Property      = NumericUpDown.MinimumProperty,
                Initializer   = initializer,
                DefaultValue  = 0,
                OtherValues   = new double[] { /*(double)double.MinValue + 1, */ -1000000, -1, 2, 1000000, /*(double)double.MaxValue*/ },
                InvalidValues = new Dictionary <double, Type>
                {
                    { double.NaN, typeof(ArgumentException) },
                    { double.NegativeInfinity, typeof(ArgumentException) },
                    { double.PositiveInfinity, typeof(ArgumentException) },
                    { (double)double.MinValue - 1, typeof(ArgumentException) },
                    { (double)double.MaxValue + 1, typeof(ArgumentException) },
                }
            };

            MaximumProperty = new DependencyPropertyTest <NumericUpDown, double>(this, "Maximum")
            {
                Property      = NumericUpDown.MaximumProperty,
                Initializer   = initializer,
                DefaultValue  = 100,
                OtherValues   = new double[] { 0, 1, 1000000, /*(double)double.MaxValue*/ },
                InvalidValues = new Dictionary <double, Type>
                {
                    { double.NaN, typeof(ArgumentException) },
                    { double.NegativeInfinity, typeof(ArgumentException) },
                    { double.PositiveInfinity, typeof(ArgumentException) },
                    { (double)double.MinValue - 1, typeof(ArgumentException) },
                    { (double)double.MaxValue + 1, typeof(ArgumentException) },
                }
            };

            IncrementProperty = new DependencyPropertyTest <NumericUpDown, double>(this, "Increment")
            {
                Property      = NumericUpDown.IncrementProperty,
                Initializer   = initializer,
                DefaultValue  = 1,
                OtherValues   = new double[] { /*0*,/ 1, 1000000 /*, (double)double.MaxValue*/ },
                InvalidValues = new Dictionary <double, Type>
                {
                    { double.NaN, typeof(ArgumentException) },
                    { double.NegativeInfinity, typeof(ArgumentException) },
                    { double.PositiveInfinity, typeof(ArgumentException) },
                    { (double)double.MinValue - 1, typeof(ArgumentException) },
                    { (double)double.MaxValue + 1, typeof(ArgumentException) },
                    { -1, typeof(ArgumentException) },
                    { 0, typeof(ArgumentException) },
                }
            };

            DecimalPlacesProperty = new DependencyPropertyTest <NumericUpDown, int>(this, "DecimalPlaces")
            {
                Property      = NumericUpDown.DecimalPlacesProperty,
                Initializer   = initializer,
                DefaultValue  = 0,
                OtherValues   = new int[] { 1, 8, 15 },
                InvalidValues = new Dictionary <int, Type>
                {
                    { -1, typeof(ArgumentException) },
                    { 16, typeof(ArgumentException) },
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the 
        /// <see cref="ExpandableContentControlTest"/> class.
        /// </summary>
        public ExpandableContentControlTest()
        {
            Func<ExpandableContentControl> initializer = () => DefaultExpandableContentControlToTest;

            RevealModeProperty = new DependencyPropertyTest<ExpandableContentControl, ExpandDirection>(this, "RevealMode")
                                     {
                                         Property = ExpandableContentControl.RevealModeProperty,
                                         Initializer = initializer,
                                         DefaultValue = ExpandDirection.Down,
                                         OtherValues =
                                             new[] { ExpandDirection.Left, ExpandDirection.Right, ExpandDirection.Up }
                                     };
            PercentageProperty = new DependencyPropertyTest<ExpandableContentControl, double>(this, "Percentage")
                                     {
                                         Property = ExpandableContentControl.PercentageProperty,
                                         Initializer = initializer,
                                         DefaultValue = 0,
                                         OtherValues = new[] { 1.0 }
                                     };
            TargetSizeProperty = new DependencyPropertyTest<ExpandableContentControl, Size>(this, "TargetSize")
                                     {
                                         Property = ExpandableContentControl.TargetSizeProperty,
                                         Initializer = initializer,
                                         DefaultValue = new Size(double.NaN, double.NaN),
                                         OtherValues = new[] { new Size(10, 10) }
                                     };
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RatingItemTest"/> class.
        /// </summary>
        public RatingItemTest()
        {
            Func<RatingItem> initializer = () => DefaultRatingItemToTest;

            DisplayValueProperty =
                new DependencyPropertyTest<RatingItem, double>(this, "DisplayValue")
                {
                    Initializer = initializer,
                    Property = RatingItem.DisplayValueProperty,
                    DefaultValue = 0.0,
                    OtherValues = new[] { 1.0, 0.5 }
                };

            IsReadOnlyProperty = new DependencyPropertyTest<RatingItem, bool>(this, "IsReadOnly")
            {
                Property = RatingItem.IsReadOnlyProperty,
                Initializer = () => DefaultRatingItemToTest,
                DefaultValue = false,
                OtherValues = new bool[] { true }
            };
        }
Ejemplo n.º 46
0
 /// <summary>
 /// Initializes a new instance of the BusyIndicatorTest class.
 /// </summary>
 public BusyIndicatorTest()
     : base()
 {
     IsBusyProperty = new DependencyPropertyTest <BusyIndicator, bool>(this, "IsBusy")
     {
         Property     = BusyIndicator.IsBusyProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = false,
         OtherValues  = new bool[] { false },
     };
     BusyContentProperty = new DependencyPropertyTest <BusyIndicator, object>(this, "BusyContent")
     {
         Property     = BusyIndicator.BusyContentProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = "Please wait...",
         OtherValues  = new object[] { 12, "Test Text", Environment.OSVersion },
     };
     BusyContentTemplateProperty = new DependencyPropertyTest <BusyIndicator, DataTemplate>(this, "BusyContentTemplate")
     {
         Property     = BusyIndicator.BusyContentTemplateProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues  = new DataTemplate[]
         {
             new DataTemplate(),
             new XamlBuilder <DataTemplate>().Load(),
             (new XamlBuilder <DataTemplate> {
                 Name = "Template"
             }).Load(),
             (new XamlBuilder <DataTemplate> {
                 Name = "Template", Children = new List <XamlBuilder> {
                     new XamlBuilder <StackPanel>()
                 }
             }).Load()
         }
     };
     DisplayAfterProperty = new DependencyPropertyTest <BusyIndicator, TimeSpan>(this, "DisplayAfter")
     {
         Property     = BusyIndicator.DisplayAfterProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = TimeSpan.FromSeconds(0.1),
         OtherValues  = new TimeSpan[] { TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(1) },
     };
     OverlayStyleProperty = new DependencyPropertyTest <BusyIndicator, Style>(this, "OverlayStyle")
     {
         Property     = BusyIndicator.OverlayStyleProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues  = new Style[] { new Style {
                                          TargetType = typeof(Rectangle)
                                      } },
     };
     ProgressBarStyleProperty = new DependencyPropertyTest <BusyIndicator, Style>(this, "ProgressBarStyle")
     {
         Property     = BusyIndicator.ProgressBarStyleProperty,
         Initializer  = () => DefaultBusyIndicatorToTest,
         DefaultValue = null,
         OtherValues  = new Style[] { new Style {
                                          TargetType = typeof(ProgressBar)
                                      } },
     };
 }
Ejemplo n.º 47
0
        public AccordionTest()
        {
            ForegroundProperty.DefaultValue = new SolidColorBrush(Colors.Black);
            PaddingProperty.DefaultValue = new Thickness(0);

            BorderBrushProperty.DefaultValue = new SolidColorBrush(Color.FromArgb(0xff, 0xea, 0xea, 0xea));
            BorderThicknessProperty.DefaultValue = new Thickness(1);

            HorizontalAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalAlignmentProperty.DefaultValue = VerticalAlignment.Top;
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
            ItemsPanelProperty.DefaultValue = new ItemsPanelTemplate();

            Func<Accordion> initializer = () => new Accordion();

            ExpandDirectionProperty = new DependencyPropertyTest<Accordion, ExpandDirection>(this, "ExpandDirection")
                                          {
                                              Property = Accordion.ExpandDirectionProperty,
                                              Initializer = initializer,
                                              DefaultValue = ExpandDirection.Down,
                                              OtherValues =
                                                  new[] { ExpandDirection.Left, ExpandDirection.Right, ExpandDirection.Up },
                                              InvalidValues = new Dictionary<ExpandDirection, Type>
                                                                  {
                                                                      { (ExpandDirection)99, typeof(ArgumentOutOfRangeException) },
                                                                      { (ExpandDirection)66, typeof(ArgumentOutOfRangeException) }
                                                                  }
                                          };

            SelectionModeProperty = new DependencyPropertyTest<Accordion, AccordionSelectionMode>(this, "SelectionMode")
                                             {
                                                 Property = Accordion.SelectionModeProperty,
                                                 Initializer = initializer,
                                                 DefaultValue = AccordionSelectionMode.One,
                                                 OtherValues =
                                                     new[]
                                                         {
                                                             AccordionSelectionMode.OneOrMore, AccordionSelectionMode.ZeroOrMore,
                                                             AccordionSelectionMode.ZeroOrOne
                                                         },
                                                 InvalidValues = new Dictionary<AccordionSelectionMode, Type>
                                                                     {
                                                                         { (AccordionSelectionMode)99, typeof(ArgumentOutOfRangeException) },
                                                                         { (AccordionSelectionMode)66, typeof(ArgumentOutOfRangeException) }
                                                                     }
                                             };
            SelectedItemProperty = new DependencyPropertyTest<Accordion, object>(this, "SelectedItem")
                                        {
                                            Property = Accordion.SelectedItemProperty,
                                            Initializer = initializer,
                                            DefaultValue = null,
                                            OtherValues = new object[] { new object() }
                                        };

            SelectedIndexProperty = new DependencyPropertyTest<Accordion, int>(this, "SelectedIndex")
                                        {
                                            Property = Accordion.SelectedIndexProperty,
                                            Initializer = initializer,
                                            DefaultValue = -1
                                        };

            SelectionSequenceProperty = new DependencyPropertyTest<Accordion, SelectionSequence>(this, "SelectionSequence")
                                            {
                                                Property = Accordion.SelectionSequenceProperty,
                                                Initializer = initializer,
                                                DefaultValue = SelectionSequence.Simultaneous,
                                                OtherValues = new[] { SelectionSequence.CollapseBeforeExpand },
                                                InvalidValues = new Dictionary<SelectionSequence, Type>
                                                                    {
                                                                        { (SelectionSequence)99, typeof(ArgumentOutOfRangeException) },
                                                                        { (SelectionSequence)66, typeof(ArgumentOutOfRangeException) }
                                                                    }
                                            };

            SelectedItemsProperty = new DependencyPropertyTest<Accordion, IList>(this, "SelectedItems")
                                        {
                                            Property = Accordion.SelectedItemsProperty,
                                            Initializer = initializer,
                                            DefaultValue = new ObservableCollection<object>()
                                        };
            SelectedIndicesProperty = new DependencyPropertyTest<Accordion, IList<int>>(this, "SelectedIndices")
                                          {
                                              Property = Accordion.SelectedIndicesProperty,
                                              Initializer = initializer,
                                              DefaultValue = new ObservableCollection<int>()
                                          };
            ItemContainerStyleProperty = new DependencyPropertyTest<Accordion, Style>(this, "ItemContainerStyle")
                                        {
                                            Property = Accordion.ItemContainerStyleProperty,
                                            Initializer = initializer,
                                            DefaultValue = null,
                                            OtherValues = new[] 
                                            {
                                                new Style(typeof(HeaderedItemsControl)), 
                                                new Style(typeof(ItemsControl)), 
                                                new Style(typeof(Control)) 
                                            }
                                        };
            ContentTemplateProperty = new DependencyPropertyTest<Accordion, DataTemplate>(this, "ContentTemplate")
                                        {
                                            Property = Accordion.ContentTemplateProperty,
                                            Initializer = initializer,
                                            DefaultValue = null,
                                            OtherValues = new[]
                                            {
                                              new DataTemplate(),
                                                new XamlBuilder<DataTemplate>().Load(),
                                                (new XamlBuilder<DataTemplate> { Name = "Template" }).Load(),
                                                (new XamlBuilder<DataTemplate> { Name = "Template", Children = new List<XamlBuilder> { new XamlBuilder<StackPanel>() } }).Load()
                                            }
                                        };

            // Default ItemsSource tests would all fail because they are not allowed 
            // to change the SelectedItemCollections in the default SelectionMode.
            ItemsSourceProperty.Initializer = () => new Accordion()
                                                        {
                                                                SelectionMode = AccordionSelectionMode.ZeroOrMore
                                                        };
        }
        /// <summary>
        /// Initializes a new instance of the AutoCompleteBoxTest class.
        /// </summary>
        public AutoCompleteBoxTest()
        {
            // Default control template values, originally from TextBox
            BackgroundProperty.DefaultValue = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));
            ForegroundProperty.DefaultValue = new SolidColorBrush(Color.FromArgb(0xff, 0x00, 0x00, 0x00));
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue = new Thickness(2);

            LinearGradientBrush lgb = new LinearGradientBrush();
            lgb.StartPoint = new Point(0.5, 0);
            lgb.EndPoint = new Point(0.5, 1);
            lgb.GradientStops.Add(new GradientStop { Color = Color.FromArgb(0xff, 0xa3, 0xae, 0xb9), Offset = 0 });
            lgb.GradientStops.Add(new GradientStop { Color = Color.FromArgb(0xff, 0x83, 0x99, 0xa9), Offset = 0.375 });
            lgb.GradientStops.Add(new GradientStop { Color = Color.FromArgb(0xff, 0x71, 0x85, 0x97), Offset = 0.375 });
            lgb.GradientStops.Add(new GradientStop { Color = Color.FromArgb(0xff, 0x61, 0x75, 0x84), Offset = 1 });
            BorderBrushProperty.DefaultValue = lgb;

            // AutoCompleteBox dependency properties
            Func<AutoCompleteBox> initializer = () => new AutoCompleteBox();
            Func<AutoCompleteBox> initializerWithContent = () =>
                {
                    AutoCompleteBox autoCompleteBox = (AutoCompleteBox)DefaultControlToTest;
                    autoCompleteBox.ItemsSource = new string[] { "a", "aa", "aaa" };
                    autoCompleteBox.PopulateComplete();
                    return autoCompleteBox;
                };
            Func<AutoCompleteBox> initializerWithContentAndTextValue = () =>
                {
                    AutoCompleteBox acb = initializerWithContent();
                    acb.Text = "aa";
                    return acb;
                };
            IsDropDownOpenProperty = new DependencyPropertyTest<AutoCompleteBox, bool>(this, "IsDropDownOpen")
                {
                    Property = AutoCompleteBox.IsDropDownOpenProperty,
                    Initializer = initializerWithContentAndTextValue,
                    DefaultValue = false,
                    OtherValues = new bool[] { true },
                    InvalidValues = new Dictionary<bool, Type> { }
                };
            IsTextCompletionEnabledProperty = new DependencyPropertyTest<AutoCompleteBox, bool>(this, "IsTextCompletionEnabled")
                {
                    Property = AutoCompleteBox.IsTextCompletionEnabledProperty,
                    Initializer = initializer,
                    DefaultValue = false,
                    OtherValues = new bool[] { true },
                    InvalidValues = new Dictionary<bool, Type> { }
                };
            ItemContainerStyleProperty = new DependencyPropertyTest<AutoCompleteBox, Style>(this, "ItemContainerStyle")
            {
                Property = AutoCompleteBox.ItemContainerStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new Style[] { new Style(typeof(AutoCompleteBox)), new Style(typeof(Control)) }
            };
            ItemFilterProperty = new DependencyPropertyTest<AutoCompleteBox, AutoCompleteFilterPredicate<object>>(this, "ItemFilter")
                {
                    Property = AutoCompleteBox.ItemFilterProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new AutoCompleteFilterPredicate<object>[] { (s, i) => true },
                    InvalidValues = new Dictionary<AutoCompleteFilterPredicate<object>, Type> { }
                };
            ItemsSourceProperty = new DependencyPropertyTest<AutoCompleteBox, IEnumerable>(this, "ItemsSource")
                {
                    Property = AutoCompleteBox.ItemsSourceProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new IEnumerable[] { new int[0], new int[] { 0 }, new int[] { 1, 2, 3 }, new string[] { "string", "strung" } },
                    InvalidValues = new Dictionary<IEnumerable, Type> { }
                };
            ItemTemplateProperty = new DependencyPropertyTest<AutoCompleteBox, DataTemplate>(this, "ItemTemplate")
            {
                Property = AutoCompleteBox.ItemTemplateProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new DataTemplate[] { new DataTemplate() }
            };
            MaxDropDownHeightProperty = new DependencyPropertyTest<AutoCompleteBox, double>(this, "MaxDropDownHeight")
                {
                    Property = AutoCompleteBox.MaxDropDownHeightProperty,
                    Initializer = initializer,
                    DefaultValue = double.PositiveInfinity,
                    OtherValues = new double[] { 0.0, 1.0, 100.0, 1000000.0 },
                    InvalidValues = new Dictionary<double, Type> { { -1.0, typeof(ArgumentException) } }
                };
            MinimumPopulateDelayProperty = new DependencyPropertyTest<AutoCompleteBox, int>(this, "MinimumPopulateDelay")
                {
                    Property = AutoCompleteBox.MinimumPopulateDelayProperty,
                    Initializer = initializer,
                    DefaultValue = 0,
                    OtherValues = new int[] { 100, 1000 },
                    InvalidValues = new Dictionary<int, Type> { { -1, typeof(ArgumentException) } }
                };
            MinimumPrefixLengthProperty = new DependencyPropertyTest<AutoCompleteBox, int>(this, "MinimumPrefixLength")
                {
                    Property = AutoCompleteBox.MinimumPrefixLengthProperty,
                    Initializer = initializer,
                    DefaultValue = 1,
                    OtherValues = new int[] { -1, 0, 100 },
                    InvalidValues = new Dictionary<int, Type> { { -2, typeof(ArgumentException) } }
                };
            FilterModeProperty = new DependencyPropertyTest<AutoCompleteBox, AutoCompleteFilterMode>(this, "FilterMode")
                {
                    Property = AutoCompleteBox.FilterModeProperty,
                    Initializer = initializer,
                    DefaultValue = AutoCompleteFilterMode.StartsWith,
                    OtherValues = new AutoCompleteFilterMode[] { AutoCompleteFilterMode.ContainsCaseSensitive, AutoCompleteFilterMode.Custom },
                    InvalidValues = new Dictionary<AutoCompleteFilterMode, Type> { { (AutoCompleteFilterMode)111, typeof(ArgumentException) } }
                };
            SearchTextProperty = new DependencyPropertyTest<AutoCompleteBox, string>(this, "SearchText")
            {
                Property = AutoCompleteBox.SearchTextProperty,
                Initializer = initializer,
                DefaultValue = "",
                OtherValues = new string[] { },
                InvalidValues = new Dictionary<string, Type> { }
            };
            SelectedItemProperty = new DependencyPropertyTest<AutoCompleteBox, object>(this, "SelectedItem")
                {
                    Property = AutoCompleteBox.SelectedItemProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new object[] { "aa" },
                    InvalidValues = new Dictionary<object, Type> { { "bb", typeof(Exception) } }
                };
            TextProperty = new DependencyPropertyTest<AutoCompleteBox, string>(this, "Text")
                {
                    Property = AutoCompleteBox.TextProperty,
                    Initializer = initializerWithContent,
                    DefaultValue = "",
                    OtherValues = new string[] { "a", "aa", "bbb" },
                    InvalidValues = new Dictionary<string, Type> { }
                };
            TextBoxStyleProperty = new DependencyPropertyTest<AutoCompleteBox, Style>(this, "TextBoxStyle")
            {
                Property = AutoCompleteBox.TextBoxStyleProperty,
                Initializer = initializer,
                DefaultValue = null,
                OtherValues = new Style[] { new Style(typeof(TextBox)), new Style(typeof(Control)) }
            };
            TextFilterProperty = new DependencyPropertyTest<AutoCompleteBox, AutoCompleteFilterPredicate<string>>(this, "TextFilter")
            {
                Property = AutoCompleteBox.TextFilterProperty,
                Initializer = initializer,
                DefaultValue = null, // Actual value not available
                OtherValues = new AutoCompleteFilterPredicate<string>[] { (s, i) => true },
                InvalidValues = new Dictionary<AutoCompleteFilterPredicate<string>, Type> { }
            };
        }
Ejemplo n.º 49
0
 /// <summary>
 /// Initializes a new instance of the WrapPanelTest class.
 /// </summary>
 public WrapPanelTest()
     : base()
 {
     Func<WrapPanel> initializer = () => DefaultWrapPanelToTest;
     ItemHeightProperty = new DependencyPropertyTest<WrapPanel, double>(this, "ItemHeight")
         {
             Property = WrapPanel.ItemHeightProperty,
             Initializer = initializer,
             DefaultValue = double.NaN,
             OtherValues = new double[] { 50.0, 100.0, 5000.0 },
             InvalidValues = new Dictionary<double, Type>
             {
                 { 0.0, typeof(ArgumentException) },
                 { -1.0, typeof(ArgumentException) },
                 { double.PositiveInfinity, typeof(ArgumentException) },
                 { double.NegativeInfinity, typeof(ArgumentException) }
             }
         };
     ItemWidthProperty = new DependencyPropertyTest<WrapPanel, double>(this, "ItemWidth")
         {
             Property = WrapPanel.ItemWidthProperty,
             Initializer = initializer,
             DefaultValue = double.NaN,
             OtherValues = new double[] { 50.0, 100.0, 5000.0 },
             InvalidValues = new Dictionary<double, Type>
             {
                 { 0.0, typeof(ArgumentException) },    
                 { -1.0, typeof(ArgumentException) },
                 { double.PositiveInfinity, typeof(ArgumentException) },
                 { double.NegativeInfinity, typeof(ArgumentException) }
             }
         };
     OrientationProperty = new DependencyPropertyTest<WrapPanel, Orientation>(this, "Orientation")
         {
             Property = WrapPanel.OrientationProperty,
             Initializer = initializer,
             DefaultValue = Orientation.Horizontal,
             OtherValues = new Orientation[] { Orientation.Vertical },
             InvalidValues = new Dictionary<Orientation, Type>
             {
                 { (Orientation)(-1), typeof(ArgumentException) },
                 { (Orientation)2, typeof(ArgumentException) },
                 { (Orientation)3, typeof(ArgumentException) },
                 { (Orientation)500, typeof(ArgumentException) },
                 { (Orientation)int.MaxValue, typeof(ArgumentException) },
                 { (Orientation)int.MinValue, typeof(ArgumentException) }
             }
         };
 }
 /// <summary>
 /// Initializes a new instance of the ContentControlTest class.
 /// </summary>
 protected ContentControlTest()
 {
     Func<ContentControl> initializer = () => DefaultContentControlToTest;
     ContentTemplateProperty = new DependencyPropertyTest<ContentControl, DataTemplate>(this, "ContentTemplate")
         {
             Property = ContentControl.ContentTemplateProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new DataTemplate[]
             {
                 new DataTemplate(),
                 new XamlBuilder<DataTemplate>().Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template" }).Load(),
                 (new XamlBuilder<DataTemplate> { Name = "Template", Children = new List<XamlBuilder> { new XamlBuilder<StackPanel>() } }).Load()
             }
         };
     ContentProperty = new DependencyPropertyTest<ContentControl, object>(this, "Content")
         {
             Property = ContentControl.ContentProperty,
             Initializer = initializer,
             DefaultValue = null,
             OtherValues = new object[] { 12, "Test Text", Environment.OSVersion, new Ellipse { Fill = new SolidColorBrush(Colors.Red), Width = 20, Height = 20 } },
             TemplateProperty = ContentTemplateProperty
         };
     HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
     VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PickerTest"/> class.
        /// </summary>
        protected PickerTest()
        {
            Func<Picker> initalizer = () => DefaultPickerToTest;

            IsDropDownOpenProperty = new DependencyPropertyTest<Picker, bool>(this, "IsDropDownOpen")
                                         {
                                             Property = Picker.IsDropDownOpenProperty,
                                             DefaultValue = false,
                                             Initializer = initalizer,
                                             OtherValues = new[] { true },
                                         };

            PopupButtonModeProperty = new DependencyPropertyTest<Picker, ClickMode>(this, "PopupButtonMode")
                                          {
                                              Property = Picker.PopupButtonModeProperty,
                                              DefaultValue = ClickMode.Release,
                                              Initializer = initalizer,
                                              OtherValues = new[] { ClickMode.Release, ClickMode.Hover },
                                              InvalidValues = new Dictionary<ClickMode, Type>
                                                                  {
                                                                      { (ClickMode)23, typeof(ArgumentException) },
                                                                      { (ClickMode)65, typeof(ArgumentException) },
                                                                  }
                                          };

            MaxDropDownHeightProperty = new DependencyPropertyTest<Picker, double>(this, "MaxDropDownHeight")
                                            {
                                                Property = Picker.MaxDropDownHeightProperty,
                                                DefaultValue = double.PositiveInfinity,
                                                Initializer = initalizer,
                                                OtherValues = new[] { 1.0, 250.0, 10000.0 },
                                                InvalidValues = new Dictionary<double, Type>
                                                    {
                                                        { -1.0, typeof(ArgumentException) },
                                                        { -11234.4, typeof(ArgumentException) },
                                                    }
                                            };
        }
Ejemplo n.º 52
0
        /// <summary>
        /// Initializes a new instance of the TreeViewTest class.
        /// </summary>
        public TreeViewTest()
            : base()
        {
            BackgroundProperty.DefaultValue = new SolidColorBrush(Colors.White);
            LinearGradientBrush brush = new LinearGradientBrush
            {
                StartPoint = new Point(0.5, 0.0),
                EndPoint = new Point(0.5, 1.0)
            };
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0xA3, 0xAE, 0xB9),
                    Offset = 0.0
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x83, 0x99, 0xA9),
                    Offset = 0.375
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x71, 0x85, 0x97),
                    Offset = 0.375
                });
            brush.GradientStops.Add(
                new GradientStop
                {
                    Color = System.Windows.Media.Color.FromArgb(0xFF, 0x61, 0x75, 0x84),
                    Offset = 1.0
                });
            BorderBrushProperty.DefaultValue = brush;
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue = new Thickness(1);

            Func<TreeView> initializer = () => DefaultTreeViewToTest;
            SelectedItemProperty = new DependencyPropertyTest<TreeView, object>(this, "SelectedItem")
                {
                    Property = TreeView.SelectedItemProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new object[] { new object() }
                };
            SelectedValueProperty = new DependencyPropertyTest<TreeView, object>(this, "SelectedValue")
                {
                    Property = TreeView.SelectedValueProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new object[] { new object() }
                };
            SelectedValuePathProperty = new DependencyPropertyTest<TreeView, string>(this, "SelectedValuePath")
                {
                    Property = TreeView.SelectedValuePathProperty,
                    Initializer = initializer,
                    DefaultValue = "",
                    OtherValues = new string[] { "Value", null }
                };
            ItemContainerStyleProperty = new DependencyPropertyTest<TreeView, Style>(this, "ItemContainerStyle")
                {
                    Property = TreeView.ItemContainerStyleProperty,
                    Initializer = initializer,
                    DefaultValue = null,
                    OtherValues = new Style[] { new Style(typeof(HeaderedItemsControl)), new Style(typeof(ItemsControl)), new Style(typeof(Control)) }
                };

            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
        }
Ejemplo n.º 53
0
        /// <summary>
        /// Initializes a new instance of the ControlTest class.
        /// </summary>
        protected ControlTest()
        {
            Func <Control> initializer = () => DefaultControlToTest;

            BackgroundProperty = new DependencyPropertyTest <Control, Brush>(this, "Background")
            {
                Property     = Control.BackgroundProperty,
                Initializer  = initializer,
                DefaultValue = null,
                OtherValues  = new Brush[] { new SolidColorBrush(Colors.Black), new SolidColorBrush(Colors.Red) }
            };
            BorderBrushProperty = new DependencyPropertyTest <Control, Brush>(this, "BorderBrush")
            {
                Property     = Control.BorderBrushProperty,
                Initializer  = () => { Control c = DefaultControlToTest; c.BorderThickness = new Thickness(2.0); return(c); },
                DefaultValue = null,
                OtherValues  = new Brush[] { new SolidColorBrush(Colors.Black), new SolidColorBrush(Colors.Red) }
            };
            BorderThicknessProperty = new DependencyPropertyTest <Control, Thickness>(this, "BorderThickness")
            {
                Property      = Control.BorderThicknessProperty,
                Initializer   = () => { Control c = DefaultControlToTest; c.BorderBrush = new SolidColorBrush(Colors.Black); return(c); },
                DefaultValue  = new Thickness(0.0),
                OtherValues   = new Thickness[] { new Thickness(2.0), new Thickness(10.0), new Thickness(0.0), new Thickness(.5), new Thickness(1, 2, 3, 4) },
                InvalidValues = new Dictionary <Thickness, Type>
                {
                    { new Thickness(-1), typeof(InvalidOperationException) }
                }
            };
            FontFamilyProperty = new DependencyPropertyTest <Control, FontFamily>(this, "FontFamily")
            {
                Property     = Control.FontFamilyProperty,
                Initializer  = initializer,
                DefaultValue = new FontFamily("Portable User Interface"),
                OtherValues  = new FontFamily[] { new FontFamily("Verdana"), new FontFamily("Courier"), new FontFamily("Times New Roman"), new FontFamily("Trebuchet MS") }
            };
            FontSizeProperty = new DependencyPropertyTest <Control, double>(this, "FontSize")
            {
                Property      = Control.FontSizeProperty,
                Initializer   = initializer,
                DefaultValue  = 11.0,
                OtherValues   = new double[] { 14.0, 5.0, 20.0 },
                InvalidValues = new Dictionary <double, Type>
                {
                    { 0.0, typeof(ArgumentException) },
                    { -1.0, typeof(ArgumentException) },
                    { double.NaN, typeof(ArgumentException) },
                    { double.PositiveInfinity, typeof(ArgumentException) },
                    { double.NegativeInfinity, typeof(ArgumentException) },
                }
            };
            FontStretchProperty = new DependencyPropertyTest <Control, FontStretch>(this, "FontStretch")
            {
                Property     = Control.FontStretchProperty,
                Initializer  = initializer,
                DefaultValue = FontStretches.Normal,
                OtherValues  = new FontStretch[] { FontStretches.Condensed, FontStretches.Expanded, FontStretches.UltraExpanded }
            };
            FontStyleProperty = new DependencyPropertyTest <Control, FontStyle>(this, "FontStyle")
            {
                Property     = Control.FontStyleProperty,
                Initializer  = initializer,
                DefaultValue = FontStyles.Normal,
                OtherValues  = new FontStyle[] { FontStyles.Italic }
            };
            FontWeightProperty = new DependencyPropertyTest <Control, FontWeight>(this, "FontWeight")
            {
                Property     = Control.FontWeightProperty,
                Initializer  = initializer,
                DefaultValue = FontWeights.Normal,
                OtherValues  = new FontWeight[] { FontWeights.Bold, FontWeights.Thin, FontWeights.ExtraBold, FontWeights.Black, FontWeights.Light }
            };
            ForegroundProperty = new DependencyPropertyTest <Control, Brush>(this, "Foreground")
            {
                Property     = Control.ForegroundProperty,
                Initializer  = initializer,
                DefaultValue = new SolidColorBrush(Colors.Black),
                OtherValues  = new Brush[] { new SolidColorBrush(Colors.Red), null, new SolidColorBrush(Colors.Blue) }
            };
            HorizontalContentAlignmentProperty = new DependencyPropertyTest <Control, HorizontalAlignment>(this, "HorizontalContentAlignment")
            {
                Property      = Control.HorizontalContentAlignmentProperty,
                Initializer   = initializer,
                DefaultValue  = HorizontalAlignment.Center,
                OtherValues   = new HorizontalAlignment[] { HorizontalAlignment.Right, HorizontalAlignment.Center, HorizontalAlignment.Stretch },
                InvalidValues = new Dictionary <HorizontalAlignment, Type>
                {
                    { (HorizontalAlignment)(-1), typeof(OverflowException) },
                    { (HorizontalAlignment)4, typeof(ArgumentException) },
                    { (HorizontalAlignment)10, typeof(ArgumentException) },
                    { (HorizontalAlignment)27, typeof(ArgumentException) },
                    { (HorizontalAlignment)int.MaxValue, typeof(OverflowException) },
                    { (HorizontalAlignment)int.MinValue, typeof(OverflowException) }
                }
            };
            IsEnabledProperty = new DependencyPropertyTest <Control, bool>(this, "IsEnabled")
            {
                Property     = Control.IsEnabledProperty,
                Initializer  = initializer,
                DefaultValue = true,
                OtherValues  = new bool[] { false }
            };
            PaddingProperty = new DependencyPropertyTest <Control, Thickness>(this, "Padding")
            {
                Property      = Control.PaddingProperty,
                Initializer   = initializer,
                DefaultValue  = new Thickness(0.0),
                OtherValues   = new Thickness[] { new Thickness(2.0), new Thickness(10.0), new Thickness(.5), new Thickness(1, 2, 3, 4) },
                InvalidValues = new Dictionary <Thickness, Type>
                {
                    { new Thickness(-1), typeof(InvalidOperationException) }
                }
            };
            VerticalContentAlignmentProperty = new DependencyPropertyTest <Control, VerticalAlignment>(this, "VerticalContentAlignment")
            {
                Property      = Control.VerticalContentAlignmentProperty,
                Initializer   = initializer,
                DefaultValue  = VerticalAlignment.Center,
                OtherValues   = new VerticalAlignment[] { VerticalAlignment.Top, VerticalAlignment.Bottom, VerticalAlignment.Stretch },
                InvalidValues = new Dictionary <VerticalAlignment, Type>
                {
                    { (VerticalAlignment)(-1), typeof(OverflowException) },
                    { (VerticalAlignment)4, typeof(ArgumentException) },
                    { (VerticalAlignment)10, typeof(ArgumentException) },
                    { (VerticalAlignment)27, typeof(ArgumentException) },
                    { (VerticalAlignment)int.MaxValue, typeof(OverflowException) },
                    { (VerticalAlignment)int.MinValue, typeof(OverflowException) }
                }
            };
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AccordionItemTest"/> class.
        /// </summary>
        public AccordionItemTest()
        {
            BackgroundProperty.DefaultValue = new SolidColorBrush(Color.FromArgb(0xff, 0xff, 0xff, 0xff));
            BorderBrushProperty.DefaultValue = new SolidColorBrush(Color.FromArgb(0xff, 0xec, 0xec, 0xec));
            BorderThicknessProperty.DefaultValue = new Thickness(1);
            PaddingProperty.DefaultValue = new Thickness(0);
            HorizontalContentAlignmentProperty.DefaultValue = HorizontalAlignment.Left;
            VerticalContentAlignmentProperty.DefaultValue = VerticalAlignment.Top;
            HorizontalAlignmentProperty.DefaultValue = HorizontalAlignment.Stretch;

            Func<AccordionItem> initializer = () => DefaultAccordionItemToTest;

            ExpandDirectionProperty = new DependencyPropertyTest<AccordionItem, ExpandDirection>(this, "ExpandDirection")
                                          {
                                              Initializer = initializer,
                                              Property = AccordionItem.ExpandDirectionProperty,
                                              DefaultValue = ExpandDirection.Down,
                                              OtherValues =
                                                  new[] { ExpandDirection.Up, ExpandDirection.Left, ExpandDirection.Right },
                                              InvalidValues = new Dictionary<ExpandDirection, Type>
                                                                  {
                                                                      { (ExpandDirection)99, typeof(ArgumentOutOfRangeException) },
                                                                      { (ExpandDirection)66, typeof(ArgumentOutOfRangeException) }
                                                                  }
                                          };
            IsSelectedProperty = new DependencyPropertyTest<AccordionItem, bool>(this, "IsSelected")
                                     {
                                         Initializer = initializer,
                                         Property = AccordionItem.IsSelectedProperty,
                                         DefaultValue = false,
                                         OtherValues = new[] { true }
                                     };

            AccordionButtonStyleProperty = new DependencyPropertyTest<AccordionItem, Style>(this, "AccordionButtonStyle")
                                               {
                                                   Initializer = initializer,
                                                   Property = AccordionItem.AccordionButtonStyleProperty,
                                                   DefaultValue = null,
                                                   OtherValues = new[] { new Style(typeof(AccordionButton)), new Style(typeof(Control)) }
                                               };

            ExpandableContentControlStyleProperty = new DependencyPropertyTest<AccordionItem, Style>(this, "ExpandableContentControlStyle")
            {
                Initializer = initializer,
                Property = AccordionItem.ExpandableContentControlStyleProperty,
                DefaultValue = null,
                OtherValues = new[] { new Style(typeof(ExpandableContentControl)), new Style(typeof(Control)) }
            };

            ContentTargetSizeProperty = new DependencyPropertyTest<AccordionItem, Size>(this, "ContentTargetSize")
            {
                Property = AccordionItem.ContentTargetSizeProperty,
                Initializer = initializer,
                DefaultValue = new Size(double.NaN, double.NaN),
                InvalidValues = new Dictionary<Size, Type>
                                    {
                                            { new Size(5, 5), typeof(InvalidOperationException) }
                                    }
            };
        }
        /// <summary>
        /// Initializes a new instance of the 
        /// <see cref="TransitioningContentControlTest"/> class.
        /// </summary>
        public TransitioningContentControlTest()
        {
            // control should not be used with UIElements
            ContentProperty.OtherValues = new object[] { 12, "Test Text", Environment.OSVersion };

            Func<TransitioningContentControl> initializer = () => new TransitioningContentControl();

            TransitionProperty = new DependencyPropertyTest<TransitioningContentControl, string>(this, "Transition")
                                     {
                                         Initializer = initializer,
                                         Property = TransitioningContentControl.TransitionProperty,
                                         DefaultValue = "DefaultTransition",
                                         OtherValues = new[] { "UpTransition", "DownTransition" }
                                     };

            RestartTransitionProperty = new DependencyPropertyTest<TransitioningContentControl, bool>(this, "RestartTransitionOnContentChange")
                                            {
                                                Initializer = initializer,
                                                Property = TransitioningContentControl.RestartTransitionOnContentChangeProperty,
                                                DefaultValue = false,
                                                OtherValues = new[] { true }
                                            };
        }