public void Initialize()
        {
            collection = new ObservableCollection<object>();
            behavior = new AutoRowDefinitions {ItemsSource = collection};

            grid = new Grid();
            Behaviors.SetAutoRowDefinitions(grid, behavior);
        }
 public static void SetAutoRowDefinitions(Grid element, AutoRowDefinitions value) { element.SetValue(AutoRowDefinitionsProperty, value); }
        public void ShouldHaveObservableCollection()
        {
            collection = new ObservableCollection<object>();
            behavior = new AutoRowDefinitions();

            behavior.ItemsSource.ShouldBe(null);
            behavior.ObservableCollection.ShouldBe(null);

            behavior.ItemsSource = collection;
            behavior.ItemsSource.ShouldNotBe(null);
            behavior.ObservableCollection.ShouldNotBe(null);
            behavior.ObservableCollection.ShouldBe(collection);

            behavior.ItemsSource = new[] { "one", "two" };
            behavior.ItemsSource.ShouldNotBe(null);
            behavior.ObservableCollection.ShouldBe(null);
        }
        public void ShouldLoadColletionOnAttach()
        {
            // Reset test objects.
            collection = new ObservableCollection<object>();
            behavior = new AutoRowDefinitions { ItemsSource = collection };
            grid = new Grid();
            
            // Items added prior to attaching behavior.
            collection.Add(1);
            collection.Add(2);
            collection.Add(3);

            // Attach behavior.
            grid.RowDefinitions.Count.ShouldBe(0);
            Behaviors.SetAutoRowDefinitions(grid, behavior);
            grid.RowDefinitions.Count.ShouldBe(3);
        }