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 ElementForValidation(); var source = new DesignDictionaryConfigurationSource(); source.Add("testSection", section); var sourceModel = Container.Resolve <ConfigurationSourceModel>(); sourceModel.Load(source); Assert.IsTrue(sourceModel.Sections .SelectMany(s => s.DescendentElements() .SelectMany(e => e.Properties) .SelectMany(p => p.ValidationResults) .Union(s.Properties.SelectMany(p => p.ValidationResults)) ).Where(e => e.IsError).Any()); }
protected override void Arrange() { base.Arrange(); var section = new ElementForValidation(); sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); }
protected override void Arrange() { base.Arrange(); var section = new ElementForValidation(); sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); validationResult = new ElementValidationResult(sectionModel, "TestMessage", true); listener = new PropertyChangedListener(validationResult); }
protected override void Arrange() { base.Arrange(); var section = new ElementForValidation(); var sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); collectionElement = sectionModel.DescendentConfigurationsOfType <NamedElementCollection <TestNamedElement> >() .Where(x => x.Name == "ReferencedItems").OfType <ElementCollectionViewModel>().First(); }
protected override void Arrange() { base.Arrange(); base.Arrange(); var section = new ElementForValidation(); var sectionModel = SectionViewModel.CreateSection(Container, "mock section", section); collectionElement = sectionModel.DescendentConfigurationsOfType <NamedElementCollection <TestNamedElement> >() .Where(x => x.Name == "ValidatedCollection").OfType <ElementCollectionViewModel>().First(); // two elements is valid collectionElement.AddNewCollectionElement(typeof(TestNamedElement)); collectionElement.AddNewCollectionElement(typeof(TestNamedElement)); }
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 ElementForValidation(); var source = new DesignDictionaryConfigurationSource(); source.Add("testSection", section); SourceModel = Container.Resolve <ConfigurationSourceModel>(); SourceModel.Load(source); Section = SourceModel.Sections.Where(s => s.SectionName == "testSection").Single(); }