예제 #1
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 ElementWithOnlyWarning();

            var source = new DesignDictionaryConfigurationSource();

            source.Add("testSection", section);

            var sourceModel = Container.Resolve <ConfigurationSourceModel>();

            sourceModel.Load(source);

            var errors = sourceModel.Sections
                         .SelectMany(s => s.DescendentElements()
                                     .SelectMany(e => e.Properties)
                                     .SelectMany(p => p.ValidationResults)
                                     .Union(s.Properties.SelectMany(p => p.ValidationResults)));

            Assert.IsTrue(errors.All(e => e.IsWarning));
        }
        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 ElementWithOnlyWarning();

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

            var sourceModel = Container.Resolve<ConfigurationSourceModel>();
            sourceModel.Load(source);

            var errors = sourceModel.Sections
                .SelectMany(s => s.DescendentElements()
                                     .SelectMany(e => e.Properties)
                                     .SelectMany(p => p.ValidationResults)
                                     .Union(s.Properties.SelectMany(p => p.ValidationResults)));

            Assert.IsTrue(errors.All(e => e.IsWarning));
        }