public void DoesntApplyIfNotItemsSourceSubclass()
 {
     WrapInAThread(() =>
                       {
                           var textBox1 = new TextBox{ DataContext = viewModel };
                           var strategy1 = new ItemsControlContentStrategy();
                           Assert.False(strategy1.Applies(new TemplateContext
                                     {
                                         Element = textBox1,
                                         TemplateOptions = options
                                     }));
                       });
 }
 public void ApplyThrowsIfNotItemsSourceSubclass()
 {
     WrapInAThread(() =>
                       {
                           var textBox1 = new TextBox { DataContext = viewModel };
                           Assert.Throws<ArgumentException>(() =>
                                                                {
                                                                    var strategy1 = new ItemsControlContentStrategy();
                                                                    strategy1.Apply(new TemplateContext
                                                                                        {
                                                                                            Element = textBox1,
                                                                                            TemplateOptions = options
                                                                                        });
                                                                });
                       });
 }
 void GenerateTemplate(ItemsControl control)
 {
     ItemsControlContentStrategy strategy = new ItemsControlContentStrategy();
     var templateContext = new TemplateContext
     {
         Element = control,
         TemplateOptions = options
     };
     if (strategy.Applies(templateContext))
     {
         strategy.Apply(templateContext);
         control.ItemsSource = viewModel.People;
     }
 }