コード例 #1
0
        protected override void Act()
        {
            var section = new MockSectionWithSingleChild();
            section.Children.Add(new TestHandlerDataWithChildren());

            this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithSingleChild();
            this.ViewModel = SectionViewModel.CreateSection(Container, "mock section", section);
        }
コード例 #3
0
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithSingleChild();

            sectionModel = SectionViewModel.CreateSection(Container, "mock section", section);
            
            elementValidationErrorsCollectionChanged = false;
            INotifyCollectionChanged elementValidationErrorsChanged = sectionModel.ValidationResults as INotifyCollectionChanged;
            elementValidationErrorsChanged.CollectionChanged += (sender, args) => elementValidationErrorsCollectionChanged = true;

            propertyValidationErrorsCollectionChanged = false;
            INotifyCollectionChanged propertyValidationErrorsChanged = sectionModel.Properties.First().ValidationResults as INotifyCollectionChanged;
            propertyValidationErrorsChanged.CollectionChanged += (sender, args) => propertyValidationErrorsCollectionChanged = true;

        }
        protected override void Arrange()
        {
            base.Arrange();

            ApplicationModel = Container.Resolve<IApplicationModel>();

            var configurationSection = new MockSectionWithSingleChild
            {
                Children = 
                {
                    {new TestHandlerDataWithChildren{Name = "Element"} }
                }
            };

            SectionViewModel sectionViewmodel = SectionViewModel.CreateSection(Container, "MockSection", configurationSection);
            Element = sectionViewmodel.GetDescendentsOfType<TestHandlerDataWithChildren>().First();
            ApplicationModel.OnSelectedElementChanged(null);
            ElementContainer = new ElementModelContainer { DataContext = Element };
        }
コード例 #5
0
        protected override void Arrange()
        {
            base.Arrange();

            var locator = new Mock<ConfigurationSectionLocator>();
            locator.Setup(x => x.ConfigurationSectionNames).Returns(new[] { "testSection" });
            Container.RegisterInstance(locator.Object);

            var section = new MockSectionWithSingleChild();
            section.Children.Add(new TestHandlerDataWithChildren() { Name = "ParentOne" });
            TestHandlerDataWithChildren child = new TestHandlerDataWithChildren() { Name = "Parent Two" };
            child.Children.Add(new TestHandlerData() { Name = "One" });
            child.Children.Add(new TestHandlerData() { Name = "Two" });
            section.Children.Add(child);

            var source = new DesignDictionaryConfigurationSource();
            source.Add("testSection", section);

            SourceModel = Container.Resolve<ConfigurationSourceModel>();
            SourceModel.Load(source);
        }
        protected override void Arrange()
        {
            base.Arrange();

            var section = new MockSectionWithSingleChild();

            section.Children.Add(CreateNewElement("One"));
            section.Children.Add(CreateNewElement("Two"));

            ViewModel = SectionViewModel.CreateSection(Container, "mock section", section);

            childrenCollection = ViewModel.DescendentElements(
                      e => e.ConfigurationType ==
                            typeof(NamedElementCollection<TestHandlerDataWithChildren>)).Cast<ElementCollectionViewModel>().First();

            startingCount =
                childrenCollection.ChildElements.Count(
                    x => typeof(TestHandlerDataWithChildren).IsAssignableFrom(x.ConfigurationType));
        }