Пример #1
0
        public void TestSimpleDoubleBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "DoubleProperty1"
            };

            var source = new MySource()
            {
                DoubleProperty1 = 42.21
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(double), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(42.21, value);

            sourceStep.SetValue(13.72);

            Assert.AreEqual(13.72, source.DoubleProperty1);
        }
Пример #2
0
        public void TestSimpleStringBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "Property1"
            };

            var source = new MySource()
            {
                Property1 = "Test 42"
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Test 42", value);

            sourceStep.SetValue("Life line");

            Assert.AreEqual("Life line", source.Property1);
        }
Пример #3
0
        public void TestSimpleIntBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "IntProperty1"
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(int), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(42, value);

            sourceStep.SetValue(72);

            Assert.AreEqual(72, source.IntProperty1);

            sourceStep.SetValue("101");
            Assert.AreEqual(101, source.IntProperty1);
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                GroupCell.Key, GroupCell.Key);
            TableView.RowHeight = 66;
            TableView.Source = source;

            var refreshControl = new MvxUIRefreshControl{Message = "Loading..."};
            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet<GroupsView, GroupsViewModel>();
            set.Bind(source).To(vm => vm.Groups);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToGroupCommand);
            set.Apply();

            TableView.ReloadData();
            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);
            spinner.Frame = new RectangleF (0, 0, 320, 66);
            //if isn't first time show spinner when busy
            TableView.TableFooterView = spinner;
            VM.IsBusyChanged = (busy) => {
                if(busy && VM.Groups.Count > 0)
                    spinner.StartAnimating();
                else
                    spinner.StopAnimating();
            };
        }
Пример #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                EventCell.Key, EventCell.Key);
            TableView.RowHeight = 66;
            TableView.Source = source;

            var refreshControl = new MvxUIRefreshControl{Message = "Loading..."};
            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet<EventsView, EventsViewModel>();
            set.Bind(source).To(vm => vm.Events);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToEventCommand);
            set.Apply();
            var spinner = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.Gray);
            spinner.Frame = new RectangleF (0, 0, 320, 66);

            TableView.TableFooterView = spinner;
            //if isn't first load show spinner when busy
            VM.IsBusyChanged = (busy) => {
                if(busy && VM.Events.Count > 0)
                    spinner.StartAnimating();
                else
                    spinner.StopAnimating();
            };
            TableView.ReloadData();
            NavigationItem.RightBarButtonItem = new UIBarButtonItem ("Stats", UIBarButtonItemStyle.Plain, delegate {
                ((EventsViewModel)ViewModel).ExecuteGoToStatsCommand();
            });
        }
Пример #6
0
        public void TestSimpleCollectionBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "Collection[0]",
                FallbackValue      = "Pah"
            };

            var source = new MySource()
            {
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Pah", value);

            source.Collection.Add("Hi there");
            value = sourceStep.GetValue();
            Assert.AreEqual("Hi there", value);

            sourceStep.SetValue("New value");
            Assert.AreEqual("New value", source.Collection[0]);
        }
Пример #7
0
        public void TestCombinerPropertiesPresentBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxCombinerSourceStepDescription()
            {
                Combiner   = new MvxAddValueCombiner(),
                InnerSteps = new List <MvxSourceStepDescription>()
                {
                    new MvxPathSourceStepDescription()
                    {
                        SourcePropertyPath = "DoubleProperty1",
                    },
                    new MvxPathSourceStepDescription()
                    {
                        SourcePropertyPath = "DoubleProperty2",
                    },
                }
            };

            var source = new MySource()
            {
                DoubleProperty1 = 12.34,
                DoubleProperty2 = 23.45
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(double), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(35.79, value);

            var changes = new List <object>();

            sourceStep.Changed += (sender, args) =>
            {
                changes.Add(sourceStep.GetValue());
            };

            source.DoubleProperty1 = 11.11;

            Assert.AreEqual(1, changes.Count);
            Assert.AreEqual(34.56, changes[0]);

            value = sourceStep.GetValue();
            Assert.AreEqual(34.56, value);

            source.DoubleProperty2 = 12.11;

            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual(23.22, changes[1]);

            value = sourceStep.GetValue();
            Assert.AreEqual(23.22, value);
        }
Пример #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(TableView);
            TableView.Source = source;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(source).For(s => s.ItemsSource).To(vm => vm.Items);
            set.Apply();
        }
Пример #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(TableView);

            TableView.Source = source;

            var set = this.CreateBindingSet <FirstView, Core.ViewModels.FirstViewModel>();

            set.Bind(source).For(s => s.ItemsSource).To(vm => vm.Items);
            set.Apply();
        }
Пример #10
0
        //****************************************

        internal void Connect(GuiPresenter presenter)
        {
            _Presenter = presenter;

            foreach (WinBoundControl MySource in _BoundControls.Values)
            {
                MySource.Attach();
            }

            if (Connected != null)
            {
                Connected(this, EventArgs.Empty);
            }
        }
Пример #11
0
        public void UpdateTableGoods()
        {
            datagrid_goods.Columns.Clear();
            datagrid_goods.ItemsSource = null;
            MySource.Clear();

            DataGridTextColumn col1 = new DataGridTextColumn();

            col1.Header  = "Name";
            col1.Width   = 197.5;
            col1.Binding = new Binding("name");
            datagrid_goods.Columns.Add(col1);
            DataGridTextColumn col2 = new DataGridTextColumn();

            col2.Header  = "Price";
            col2.Width   = 189;
            col2.Binding = new Binding("price");
            datagrid_goods.Columns.Add(col2);
            DataGridTextColumn col3 = new DataGridTextColumn();

            col3.Header  = "Category";
            col3.Width   = 197.5;
            col3.Binding = new Binding("category");
            datagrid_goods.Columns.Add(col3);
            DataGridTextColumn col4 = new DataGridTextColumn();

            col4.Header  = "Image";
            col4.Width   = 197.5;
            col4.Binding = new Binding("image_path");
            datagrid_goods.Columns.Add(col4);

            string temp = "";

            foreach (var i in controller.GetListGoodsId())
            {
                if (i.id_category != null)
                {
                    temp = controller.GetCategoryById(Convert.ToInt32(i.id_category)).name;
                }

                MySource.Add(new MyData
                {
                    name       = i.name,
                    price      = (decimal)i.price,
                    category   = temp,
                    image_path = i.image
                });
            }
            datagrid_goods.ItemsSource = MySource;
        }
Пример #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                                      EventCell.Key, EventCell.Key);

            TableView.RowHeight = 66;
            TableView.Source    = source;

            var refreshControl = new MvxUIRefreshControl {
                Message = "Loading..."
            };

            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet <EventsView, EventsViewModel>();

            set.Bind(source).To(vm => vm.Events);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToEventCommand);
            set.Apply();
            var spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            spinner.Frame = new RectangleF(0, 0, 320, 66);

            TableView.TableFooterView = spinner;
            //if isn't first load show spinner when busy
            VM.IsBusyChanged = (busy) => {
                if (busy && VM.Events.Count > 0)
                {
                    spinner.StartAnimating();
                }
                else
                {
                    spinner.StopAnimating();
                }
            };
            TableView.ReloadData();
            NavigationItem.RightBarButtonItem = new UIBarButtonItem("Stats", UIBarButtonItemStyle.Plain, delegate {
                ((EventsViewModel)ViewModel).ExecuteGoToStatsCommand();
            });
        }
Пример #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var source = new MySource(VM, TableView,
                                      GroupCell.Key, GroupCell.Key);

            TableView.RowHeight = 66;
            TableView.Source    = source;


            var refreshControl = new MvxUIRefreshControl {
                Message = "Loading..."
            };

            this.RefreshControl = refreshControl;

            var set = this.CreateBindingSet <GroupsView, GroupsViewModel>();

            set.Bind(source).To(vm => vm.Groups);
            set.Bind(refreshControl).For(r => r.IsRefreshing).To(vm => vm.IsBusy);
            set.Bind(refreshControl).For(r => r.RefreshCommand).To(vm => vm.RefreshCommand);
            set.Bind(source).For(s => s.SelectionChangedCommand).To(vm => vm.GoToGroupCommand);
            set.Apply();

            TableView.ReloadData();
            var spinner = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.Gray);

            spinner.Frame = new RectangleF(0, 0, 320, 66);
            //if isn't first time show spinner when busy
            TableView.TableFooterView = spinner;
            VM.IsBusyChanged          = (busy) => {
                if (busy && VM.Groups.Count > 0)
                {
                    spinner.StartAnimating();
                }
                else
                {
                    spinner.StopAnimating();
                }
            };
        }
Пример #14
0
        public void TestSimpleSubPropertyBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "SubSource.SubProperty2"
            };

            var source = new MySource()
            {
                SubSource = new MySubSource()
                {
                    SubProperty2 = "Hello World"
                }
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Hello World", value);

            source.SubSource.SubProperty2 = "Hello Mum";

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            value = sourceStep.GetValue();
            Assert.AreEqual("Hello Mum", value);
            source.SubSource.SubProperty2 = "Hello Mum";

            source.SubSource = null;

            Assert.AreEqual(typeof(object), sourceStep.SourceType);

            value = sourceStep.GetValue();
            Assert.AreEqual(MvxBindingConstant.UnsetValue, value);
        }
Пример #15
0
        public void When_Binding_Set_Null()
        {
            var textBox = new TextBox();
            var source  = new MySource()
            {
                SourceText = "Spinach"
            };

            textBox.DataContext = source;
            textBox.SetBinding(TextBox.TextProperty, new Binding()
            {
                Path = new PropertyPath("SourceText")
            });

            Assert.AreEqual("Spinach", textBox.Text);

            source.SourceText = null;

            Assert.AreEqual("", textBox.Text);
        }
Пример #16
0
        public void When_Binding_Set_Non_String()
        {
            var passwordBox = new PasswordBox();
            var source      = new MySource()
            {
                SourceInt = 12
            };

            passwordBox.DataContext = source;
            passwordBox.SetBinding(PasswordBox.PasswordProperty, new Binding()
            {
                Path = new PropertyPath("SourceInt")
            });

            Assert.AreEqual("12", passwordBox.Password);

            source.SourceInt = 19;

            Assert.AreEqual("19", passwordBox.Password);
        }
Пример #17
0
        public void When_Binding_Set_Null()
        {
            var passwordBox = new PasswordBox();
            var source      = new MySource()
            {
                SourceText = "Spinach"
            };

            passwordBox.DataContext = source;
            passwordBox.SetBinding(PasswordBox.PasswordProperty, new Binding()
            {
                Path = new PropertyPath("SourceText")
            });

            Assert.AreEqual("Spinach", passwordBox.Password);

            source.SourceText = null;

            Assert.AreEqual("", passwordBox.Password);
        }
Пример #18
0
        public void When_Binding_Set_Non_String()
        {
            var textBox = new TextBox();
            var source  = new MySource()
            {
                SourceInt = 12
            };

            textBox.DataContext = source;
            textBox.SetBinding(TextBox.TextProperty, new Binding()
            {
                Path = new PropertyPath("SourceInt")
            });

            Assert.AreEqual("12", textBox.Text);

            source.SourceInt = 19;

            Assert.AreEqual("19", textBox.Text);
        }
Пример #19
0
        public void TestSimpleIntWithValueConversionBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "IntProperty1",
                Converter          = new IntPlus1ValueConverter()
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(int), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(43, value);

            int changed = -99;

            sourceStep.Changed += (sender, args) => changed = (int)sourceStep.GetValue();

            source.IntProperty1 = 71;
            Assert.AreEqual(72, changed);

            value = sourceStep.GetValue();
            Assert.AreEqual(72, value);

            sourceStep.SetValue(101);
            Assert.AreEqual(100, source.IntProperty1);
        }
Пример #20
0
        public void TestLiteralDoubleBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxLiteralSourceStepDescription()
            {
                Literal = 13.72
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(double), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual(13.72, value);
        }
Пример #21
0
        public void TestLiteralStringBinding()
        {
            var realSourceStepFactory = SetupSourceStepFactory();

            var sourceStepDescription = new MvxLiteralSourceStepDescription()
            {
                Literal = "Love it"
            };

            var source = new MySource()
            {
                IntProperty1 = 42
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Love it", value);
        }
Пример #22
0
        public void TestIndedexedChangePropagationBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "Collection[0]"
            };

            var source = new MySource()
            {
            };

            source.Collection.Add("Initial");

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Initial", value);

            var changes = new List <object>();

            sourceStep.Changed += (sender, args) =>
            {
                changes.Add(sourceStep.GetValue());
            };

            source.Collection[0] = "Changed to 17";

            Assert.AreEqual(1, changes.Count);
            Assert.AreEqual("Changed to 17", changes[0]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed to 17", value);

            sourceStep.DataContext = new MySource();

            value = sourceStep.GetValue();
            Assert.AreEqual(MvxBindingConstant.UnsetValue, value);

            source.Collection[0] = "Changed again 19";

            Assert.AreEqual(1, changes.Count);

            sourceStep.DataContext = source;

            Assert.AreEqual(1, changes.Count);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed again 19", value);

            source.Collection[0] = "Changed again again 19";

            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual("Changed again again 19", changes[1]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed again again 19", value);
        }
Пример #23
0
 public ContactViewController()
 {
     source = new MySource <Person> ();
     this.TableView.Source = source;
 }
Пример #24
0
        public void TestSimpleChangePropagationBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "Property1"
            };

            var source = new MySource()
            {
                Property1 = "Test 42"
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Test 42", value);

            var changes = new List <object>();

            sourceStep.Changed += (sender, args) =>
            {
                changes.Add(sourceStep.GetValue());
            };

            source.Property1 = "Changed to 17";

            Assert.AreEqual(1, changes.Count);
            Assert.AreEqual("Changed to 17", changes[0]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed to 17", value);

            sourceStep.DataContext = new MySource();

            value = sourceStep.GetValue();
            Assert.AreEqual(null, value);

            source.Property1 = "Changed again 19";

            Assert.AreEqual(1, changes.Count);

            sourceStep.DataContext = source;

            Assert.AreEqual(1, changes.Count);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed again 19", value);

            source.Property1 = "Changed again again 19";

            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual("Changed again again 19", changes[1]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed again again 19", value);
        }
Пример #25
0
 public MyElementViewModel(MySource source)
 {
     Source   = source;
     BCommand = new MvxCommand(ExecuteBCommand);
 }
Пример #26
0
        public void TestCombinerPropertiesMissingBinding_Part2()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxCombinerSourceStepDescription()
            {
                Combiner   = new MvxAddValueCombiner(),
                InnerSteps = new List <MvxSourceStepDescription>()
                {
                    new MvxPathSourceStepDescription()
                    {
                        SourcePropertyPath = "SubSource.SubProperty1",
                        FallbackValue      = "It was missing"
                    },
                    new MvxPathSourceStepDescription()
                    {
                        SourcePropertyPath = "DoubleProperty1",
                    },
                }
            };

            var source = new MySource()
            {
                DoubleProperty1 = 12.34,
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(object), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("It was missing12.34", value);

            var changes = new List <object>();

            sourceStep.Changed += (sender, args) =>
            {
                changes.Add(sourceStep.GetValue());
            };

            source.DoubleProperty1 = 11.11;

            Assert.AreEqual(1, changes.Count);
            Assert.AreEqual("It was missing11.11", changes[0]);

            value = sourceStep.GetValue();
            Assert.AreEqual("It was missing11.11", value);

            source.DoubleProperty1 = 12.11;

            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual("It was missing12.11", changes[1]);

            value = sourceStep.GetValue();
            Assert.AreEqual("It was missing12.11", value);

            source.SubSource = new MySubSource()
            {
                SubProperty1 = "Hello"
            };

            Assert.AreEqual(3, changes.Count);
            Assert.AreEqual("Hello12.11", changes[2]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Hello12.11", value);
        }
Пример #27
0
 private void ExecuteBCommand(MySource source)
 {
     Debug.WriteLine("ExecuteBCommand. Source: A={0}, B={1}", source.A, source.B);
 }
Пример #28
0
        public void TestSimpleSubObjectChangePropagationBinding()
        {
            var realSourceStepFactory = this.SetupSourceStepFactory();

            var sourceStepDescription = new MvxPathSourceStepDescription()
            {
                SourcePropertyPath = "SubSource.SubProperty1"
            };

            var source = new MySource()
            {
                SubSource = new MySubSource()
                {
                    SubProperty1 = "Test 42"
                }
            };

            var sourceStep = realSourceStepFactory.Create(sourceStepDescription);

            sourceStep.DataContext = source;

            Assert.AreEqual(typeof(string), sourceStep.SourceType);

            object value = sourceStep.GetValue();

            Assert.AreEqual("Test 42", value);

            var changes = new List <object>();

            sourceStep.Changed += (sender, args) =>
            {
                changes.Add(sourceStep.GetValue());
            };

            source.SubSource.SubProperty1 = "Changed to 17";

            Assert.AreEqual(1, changes.Count);
            Assert.AreEqual("Changed to 17", changes[0]);

            value = sourceStep.GetValue();
            Assert.AreEqual("Changed to 17", value);

            var oldSubSource = source.SubSource;

            source.SubSource = new MySubSource()
            {
                SubProperty1 = "New Sub object"
            };

            Assert.AreEqual(2, changes.Count);
            Assert.AreEqual("New Sub object", changes[1]);

            value = sourceStep.GetValue();
            Assert.AreEqual("New Sub object", value);

            oldSubSource.SubProperty1 = "Should not fire";

            Assert.AreEqual(2, changes.Count);

            source.SubSource.SubProperty1 = "Should fire";

            Assert.AreEqual(3, changes.Count);
            Assert.AreEqual("Should fire", changes[2]);
        }