public void then_validator_throws_error_message() { ValidationViewModel.Validate(); var lowerBoundProperty = ValidationViewModel.DescendentConfigurationsOfType <StringLengthValidatorData>().First().Properties.Single(p => p.PropertyName == "LowerBound"); Assert.AreEqual(1, lowerBoundProperty.ValidationResults.Count()); }
protected override void Act() { var handlersCollection = exceptionHandlingViewModel.DescendentConfigurationsOfType <NamedElementCollection <ExceptionHandlerData> >() .OfType <ElementCollectionViewModel>().First(); addedHandlerViewModel = handlersCollection.AddNewCollectionElement(typeof(WrapHandlerData)); }
private void EnsureLogFormatter() { formatter = loggingSection.DescendentConfigurationsOfType <FormatterData>().FirstOrDefault(); if (formatter == null) { var formatters = GetCollectionOfType <NamedElementCollection <FormatterData> >(loggingSection); formatter = formatters.AddNewCollectionElement(typeof(TextFormatterData)); formatter.Property("Template").Value = TextFormatterData.DefaultTemplate; } }
private void EnsurePolicy() { policyModel = exceptionSettingsSection.DescendentConfigurationsOfType <ExceptionPolicyData>() .Where(x => (string)x.Property("Name").Value == wizardData.Policy).FirstOrDefault(); if (policyModel == null) { var policies = GetCollectionOfType <NamedElementCollection <ExceptionPolicyData> >(exceptionSettingsSection); policyModel = policies.AddNewCollectionElement(typeof(ExceptionPolicyData)); policyModel.Property("Name").Value = wizardData.Policy; } }
public IConnectionVerifier WithConnectionString(string name) { currentSection = model.Sections.Where(s => s.ConfigurationType == typeof(ConnectionStringsSection)).First(); Assert.IsTrue(model != null, "ConfigurationSourceModel does not contain ConnectionStringsSection"); currentConnection = currentSection.DescendentConfigurationsOfType<ConnectionStringSettings>() .Where(x => x.Name == name).FirstOrDefault(); Assert.IsNotNull(currentConnection, string.Format("Could not locate connection {0}", name)); return this; }
public IConnectionVerifier WithConnectionString(string name) { currentSection = model.Sections.Where(s => s.ConfigurationType == typeof(ConnectionStringsSection)).First(); Assert.IsTrue(model != null, "ConfigurationSourceModel does not contain ConnectionStringsSection"); currentConnection = currentSection.DescendentConfigurationsOfType <ConnectionStringSettings>() .Where(x => x.Name == name).FirstOrDefault(); Assert.IsNotNull(currentConnection, string.Format("Could not locate connection {0}", name)); return(this); }
/// <summary>Asserts all properties have applied custom view model.</summary> private void AssertProperty <TConfigurationElement>(Func <Property, bool> propertyFilter) where TConfigurationElement : ConfigurationElement { var matchDataEntries = piabViewModel.DescendentConfigurationsOfType <TConfigurationElement>(); IEnumerable <Property> properties = matchDataEntries.SelectMany( e => e.Properties.Where(propertyFilter)); Assert.IsTrue(properties.Any(), "Could not find any properties to match filter"); Assert.IsTrue(properties.All(p => typeof(CollectionEditorContainedElementProperty).IsAssignableFrom(p.GetType()))); }
private void AddConnection(SectionViewModel connectionSection) { var connection = connectionSection.DescendentConfigurationsOfType <ConnectionStringSettings>() .Where(s => (string)s.Property("Name").Value == wizardData.Name).FirstOrDefault(); if (connection == null) { var connectionStrings = GetCollectionOfType <ConnectionStringSettingsCollection>(connectionSection); connection = connectionStrings.AddNewCollectionElement(typeof(ConnectionStringSettings)); connection.Property("Name").Value = wizardData.Name; connection.Property("ConnectionString").Value = wizardData.ConnectionString; connection.Property("ProviderName").Value = wizardData.ProviderName; } }
private void AddConnection(SectionViewModel connectionSection) { var connection = connectionSection.DescendentConfigurationsOfType<ConnectionStringSettings>() .Where(s => (string)s.Property("Name").Value == wizardData.Name).FirstOrDefault(); if (connection == null) { var connectionStrings = GetCollectionOfType<ConnectionStringSettingsCollection>(connectionSection); connection = connectionStrings.AddNewCollectionElement(typeof(ConnectionStringSettings)); connection.Property("Name").Value = wizardData.Name; connection.Property("ConnectionString").Value = wizardData.ConnectionString; connection.Property("ProviderName").Value = wizardData.ProviderName; } }
protected override void Act() { removedHandlerViewModel = exceptionHandlingViewModel.DescendentConfigurationsOfType <ExceptionHandlerData>().First(); removedHandlerViewModel.Delete(); }
public void then_should_not_return_unrelated_categories() { Assert.IsTrue(sectionViewModel.DescendentConfigurationsOfType <TraceSourceData>().Any(x => x.Name == "msmq")); Assert.IsFalse(relatedElements.Where(x => x.Name == "msmq").Any()); }
protected override void Act() { property = sectionViewModel.DescendentConfigurationsOfType <ChildConfigurationElement>().First().Property( "SomeStringProperty"); }
protected override void Act() { var sourceElement = configSourceSectionViewModel.DescendentConfigurationsOfType <ConfigurationSourceElement>().First(); deleteCommand = sourceElement.DeleteCommand; }