Ejemplo n.º 1
0
        public void TestInsertChild1()
        {
            var dataSource = _dataSources.AddGroup();
            var model      = new MergedDataSourceViewModel(dataSource, _actionCenter.Object);

            SingleDataSource source = _dataSources.AddDataSource("foo");
            var sourceViewModel     = new SingleDataSourceViewModel(source, _actionCenter.Object);

            model.Insert(0, sourceViewModel);
            sourceViewModel.CharacterCode.Should().Be("A", "because the merged data source is responsible for providing unique character codes");
        }
Ejemplo n.º 2
0
        public void TestInsertChild2()
        {
            var dataSource = _dataSources.AddGroup();
            var model      = new MergedDataSourceViewModel(dataSource, _actionCenter.Object);

            var child1 = new SingleDataSourceViewModel(_dataSources.AddDataSource("foo"), _actionCenter.Object);

            model.AddChild(child1);
            child1.CharacterCode.Should().Be("A");

            var child2 = new SingleDataSourceViewModel(_dataSources.AddDataSource("bar"), _actionCenter.Object);

            model.Insert(0, child2);
            model.Observable.Should().Equal(new object[]
            {
                child2, child1
            });

            const string reason = "because the merged data source is responsible for providing unique character codes";

            child2.CharacterCode.Should().Be("A", reason);
            child1.CharacterCode.Should().Be("B", reason);
        }