public void LoggingHandlerNodeTest() { string name = "some name"; int eventId = 3234; int priority = -1; Type formatterType = typeof(Guid); TraceEventType severity = TraceEventType.Resume; LoggingExceptionHandlerData loggingHandlerData = new LoggingExceptionHandlerData(); loggingHandlerData.Name = name; loggingHandlerData.EventId = eventId; loggingHandlerData.Priority = priority; loggingHandlerData.FormatterType = formatterType; loggingHandlerData.Severity = severity; LoggingExceptionHandlerNode exceptionHandlerNode = new LoggingExceptionHandlerNode(loggingHandlerData); ApplicationNode.AddNode(exceptionHandlerNode); LoggingExceptionHandlerData nodeData = (LoggingExceptionHandlerData)exceptionHandlerNode.ExceptionHandlerData; Assert.AreEqual(name, nodeData.Name); Assert.AreEqual(eventId, nodeData.EventId); Assert.AreEqual(formatterType, nodeData.FormatterType); Assert.AreEqual(priority, nodeData.Priority); Assert.AreEqual(severity, nodeData.Severity); }
public void CustomHashProviderDataTest() { try { string name = "testName2"; Type type = typeof(CustomHashProviderNodeFixture); NameValueCollection attributes = new NameValueCollection(); attributes.Add("test", "value"); CustomHashProviderData data = new CustomHashProviderData(); data.Name = name; data.Type = type; data.Attributes.Add(attributes.GetKey(0), attributes[attributes.GetKey(0)]); CustomHashProviderNode node = new CustomHashProviderNode(data); ApplicationNode.AddNode(node); Assert.AreEqual(name, node.Name); Assert.AreEqual(type, node.Type); Assert.AreEqual(attributes.AllKeys[0], node.Attributes[0].Key); Assert.AreEqual(attributes.Get(0), node.Attributes[0].Value); } finally { File.Delete("KeyedHashKey.file"); } }
public void CanReadAndWriteConfigurationSourceConfiguration() { manager.Register(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ApplicationNode.AddNode(GetSectionNode()); manager.Save(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ApplicationNode.ClearChildNodes(); manager.Open(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ConfigurationSourceSectionNode node = (ConfigurationSourceSectionNode)ApplicationNode.Nodes[0]; Assert.IsNotNull(node); Assert.AreEqual(2, node.Nodes.Count); Assert.AreEqual(typeof(FileConfigurationSourceElementNode), node.SelectedSource.GetType()); ApplicationNode.ClearChildNodes(); manager.Save(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); }
public void CustomHashProviderNodeTest() { string name = "testName1"; Type type = typeof(CustomHashProviderData); NameValueCollection attributes = new NameValueCollection(); attributes.Add("test", "value"); CustomHashProviderNode node = new CustomHashProviderNode(); ApplicationNode.AddNode(node); Assert.AreEqual("Custom Hash Provider", node.Name); node.Type = type; node.Name = name; node.Attributes.Add(new EditableKeyValue(attributes.GetKey(0), attributes[attributes.GetKey(0)])); Assert.AreEqual(attributes[0], node.Attributes[0].Value); Assert.AreEqual(type, node.Type); Assert.AreEqual(name, node.Name); CustomHashProviderData nodeData = (CustomHashProviderData)node.HashProviderData; Assert.AreEqual(name, nodeData.Name); Assert.AreEqual(type, nodeData.Type); Assert.AreEqual(attributes.AllKeys[0], nodeData.Attributes.AllKeys[0]); Assert.AreEqual(attributes.Get(0), nodeData.Attributes.Get(0)); }
public void EmailTraceListenerNodeTest() { string name = "some name"; string subjectSuffix = "subject suffix"; string subjectPrefix = "subject prefix"; string toAddress = "some to address"; string fromAddress = "some from address"; string smtpServer = "some server"; int smtpPort = 123; EmailTraceListenerNode emailTraceListenerNode = new EmailTraceListenerNode(); emailTraceListenerNode.Name = name; emailTraceListenerNode.SubjectLineStarter = subjectPrefix; emailTraceListenerNode.SubjectLineEnder = subjectSuffix; emailTraceListenerNode.ToAddress = toAddress; emailTraceListenerNode.FromAddress = fromAddress; emailTraceListenerNode.SmtpServer = smtpServer; emailTraceListenerNode.SmtpPort = smtpPort; ApplicationNode.AddNode(emailTraceListenerNode); EmailTraceListenerData nodeData = (EmailTraceListenerData)emailTraceListenerNode.TraceListenerData; Assert.AreEqual(name, nodeData.Name); Assert.AreEqual(subjectSuffix, nodeData.SubjectLineEnder); Assert.AreEqual(subjectPrefix, nodeData.SubjectLineStarter); Assert.AreEqual(toAddress, nodeData.ToAddress); Assert.AreEqual(fromAddress, nodeData.FromAddress); Assert.AreEqual(smtpPort, nodeData.SmtpPort); Assert.AreEqual(smtpServer, nodeData.SmtpServer); }
public void EmailTraceListenerNodeDataTest() { string name = "some name"; string subjectSuffix = "subject suffix"; string subjectPrefix = "subject prefix"; string toAddress = "some to address"; string fromAddress = "some from address"; string smtpServer = "some server"; int smtpPort = 123; SourceLevels filter = SourceLevels.Critical; EmailTraceListenerData emailTraceListenerData = new EmailTraceListenerData(); emailTraceListenerData.Name = name; emailTraceListenerData.ToAddress = toAddress; emailTraceListenerData.FromAddress = fromAddress; emailTraceListenerData.SmtpServer = smtpServer; emailTraceListenerData.SmtpPort = smtpPort; emailTraceListenerData.SubjectLineEnder = subjectSuffix; emailTraceListenerData.SubjectLineStarter = subjectPrefix; emailTraceListenerData.Filter = filter; EmailTraceListenerNode emailTraceListenerNode = new EmailTraceListenerNode(emailTraceListenerData); ApplicationNode.AddNode(emailTraceListenerNode); Assert.AreEqual(name, emailTraceListenerNode.Name); Assert.AreEqual(subjectSuffix, emailTraceListenerNode.SubjectLineEnder); Assert.AreEqual(subjectPrefix, emailTraceListenerNode.SubjectLineStarter); Assert.AreEqual(toAddress, emailTraceListenerNode.ToAddress); Assert.AreEqual(fromAddress, emailTraceListenerNode.FromAddress); Assert.AreEqual(smtpPort, emailTraceListenerNode.SmtpPort); Assert.AreEqual(smtpServer, emailTraceListenerNode.SmtpServer); Assert.AreEqual(filter, emailTraceListenerNode.Filter); }
public void CanReadAndWriteInstrumentationConfiguration() { manager.Register(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ApplicationNode.AddNode(new InstrumentationNode(new InstrumentationConfigurationSection(true, true, false))); manager.Save(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); ApplicationNode.ClearChildNodes(); manager.Open(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); InstrumentationNode node = (InstrumentationNode)ApplicationNode.Nodes[0]; Assert.IsNotNull(node); Assert.IsTrue(node.EventLoggingEnabled); Assert.IsTrue(node.PerformanceCountersEnabled); Assert.IsFalse(node.WmiEnabled); ApplicationNode.ClearChildNodes(); manager.Save(ServiceProvider); Assert.AreEqual(0, ErrorLogService.ValidationErrorCount); Assert.AreEqual(0, ErrorLogService.ConfigurationErrorCount); }
public Func <Option> Compile(ApplicationNode node) { if (!(node.Option is OptionNode) || !(node.Operand is OptionNode)) { throw new Exception("Invalid AST"); } passes.ForEach(node.Accept); foreach (var tb in OptionTypes.Values) { tb.TypeBuilder.CreateType(); } //AssemblyBuilder.Save(AssemblyBuilder.GetName().Name + ".dll"); var optionID = ((OptionNode)node.Option).ID; var operandID = ((OptionNode)node.Operand).ID; var optionType = AssemblyBuilder.GetType("OptionCalculusCompiled.Option" + optionID); var operandType = AssemblyBuilder.GetType("OptionCalculusCompiled.Option" + operandID); var option = (Option)Activator.CreateInstance(optionType); var operand = (Option)Activator.CreateInstance(operandType); return(() => { var scope = new Scope <Option>(); scope.Bind(option.Key, operand); return option.Eval(scope, operand); }); }
public void CustomSymmetricCryptoProviderNodeTest() { Type type = typeof(CustomSymmetricCryptoProviderNodeFixture); string name = "some name"; NameValueCollection attributes = new NameValueCollection(); attributes.Add("Test", "Value"); CustomSymmetricCryptoProviderNode node = new CustomSymmetricCryptoProviderNode(); ApplicationNode.AddNode(node); Assert.AreEqual("Custom Symmetric Cryptography Provider", node.Name); node.Name = name; node.Type = type.AssemblyQualifiedName; node.Attributes.Add(new EditableKeyValue(attributes.GetKey(0), attributes[attributes.GetKey(0)])); Assert.AreEqual(attributes[0], node.Attributes[0].Value); Assert.AreEqual(name, node.Name); Assert.AreEqual(type.AssemblyQualifiedName, node.Type); CustomSymmetricCryptoProviderData data = (CustomSymmetricCryptoProviderData)node.SymmetricCryptoProviderData; Assert.AreEqual(name, data.Name); Assert.AreEqual(type, data.Type); Assert.AreEqual(attributes.AllKeys[0], data.Attributes.AllKeys[0]); Assert.AreEqual(attributes.Get(0), data.Attributes.Get(0)); }
public void AllTraceSourcesDefaultDataTest() { AllTraceSourceNode allTraceSourcesNode = new AllTraceSourceNode(new TraceSourceData()); ApplicationNode.AddNode(allTraceSourcesNode); Assert.AreEqual("All Events", allTraceSourcesNode.Name); Assert.AreEqual(0, allTraceSourcesNode.Nodes.Count); }
public void NotProcessedTraceSourceDefaultDataTest() { NotProcessedTraceSourceNode notProcessedTraceSourcesNode = new NotProcessedTraceSourceNode(new TraceSourceData()); ApplicationNode.AddNode(notProcessedTraceSourcesNode); Assert.AreEqual("Unprocessed Category", notProcessedTraceSourcesNode.Name); Assert.AreEqual(0, notProcessedTraceSourcesNode.Nodes.Count); }
protected override void InitializeCore() { regexNode = new MyRegexTestNode(); ApplicationNode.AddNode(regexNode); emailInfo = regexNode.GetType().GetProperty("Email"); serviceProvider = ServiceBuilder.Build(); hierarchy = new ConfigurationUIHierarchy(ApplicationNode, serviceProvider); }
public void CanFindChildOfParentByType() { ApplicationNode.AddNode(new TempNode("Child")); ApplicationNode.AddNode(new TempNode("Child")); IList <ConfigurationNode> foundNodes = Hierarchy.FindNodesByType(typeof(TempNode)); Assert.AreEqual(2, foundNodes.Count); }
public void ErrorsTraceSourceDefaultDataTest() { ErrorsTraceSourceNode errorsTraceSourcesNode = new ErrorsTraceSourceNode(new TraceSourceData()); ApplicationNode.AddNode(errorsTraceSourcesNode); Assert.AreEqual("Logging Errors & Warnings", errorsTraceSourcesNode.Name); Assert.AreEqual(0, errorsTraceSourcesNode.Nodes.Count); }
protected override void InitializeCore() { requiredNode = new MyRequiredTestNode(); ApplicationNode.AddNode(requiredNode); valueInfo1 = requiredNode.GetType().GetProperty("Value1"); valueInfo2 = requiredNode.GetType().GetProperty("Value2"); serviceProvider = ServiceBuilder.Build(); hierarchy = new ConfigurationUIHierarchy(ApplicationNode, serviceProvider); }
public void SecuritySettingsNodeDefaultDataTest() { SecuritySettingsNode securitySettings = new SecuritySettingsNode(); ApplicationNode.AddNode(securitySettings); Assert.IsNull(securitySettings.DefaultAuthorizationInstance); Assert.IsNull(securitySettings.DefaultSecurityCacheInstance); Assert.AreEqual("Security Application Block", securitySettings.Name); }
public void CanInitializeTheHierarchyWhenRootIsAttachedWithChildren() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child2")); node.AddNode(new TestNode("Child3")); Assert.AreEqual(4, ((IContainer)Hierarchy).Components.Count); }
public void LoggingSettingsNodeDefaultDataTest() { LoggingSettingsNode loggingSettings = new LoggingSettingsNode(); ApplicationNode.AddNode(loggingSettings); Assert.AreEqual(false, loggingSettings.LogWarningWhenNoCategoriesMatch); Assert.AreEqual(false, loggingSettings.TracingEnabled); Assert.AreEqual("Logging Application Block", loggingSettings.Name); Assert.IsNull(loggingSettings.DefaultCategory); }
public void EnsureNodesAreNamesAreUniqueWhenAddedToTheContainer() { TestNode child1 = new TestNode("Child"); TestNode child2 = new TestNode("Child"); ApplicationNode.AddNode(child1); ApplicationNode.AddNode(child2); Assert.AreEqual("Child1", child2.Name); }
public void CanFindNodeByPath() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TestNode("Child2")); ConfigurationNode foundNode = Hierarchy.FindNodeByPath(node.Path); Assert.AreSame(node, foundNode); }
public void CategoryTraceSourceDefaultDataTest() { string name = "some name"; NotProcessedTraceSourceNode categoryTraceSourcesNode = new NotProcessedTraceSourceNode(new TraceSourceData()); categoryTraceSourcesNode.Name = name; ApplicationNode.AddNode(categoryTraceSourcesNode); Assert.AreEqual(name, categoryTraceSourcesNode.Name); Assert.AreEqual(0, categoryTraceSourcesNode.Nodes.Count); }
public void CanDetermineIfAParentInTheHierarchyContainsANodeType() { TempNode node = new TempNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TestNode("Child2")); node.Nodes[0].AddNode(new TempNode("Child")); Assert.IsTrue(Hierarchy.ContainsNodeType(node, typeof(TempNode))); }
protected void SetDictionaryConfigurationSource(DictionaryConfigurationSource configurationSource) { ConfigurationSourceSectionNode configurationSourceSection = new ConfigurationSourceSectionNode(); DictionarySourceElementNode configurationSourceNode = new DictionarySourceElementNode(configurationSource); ApplicationNode.AddNode(configurationSourceSection); configurationSourceSection.AddNode(configurationSourceNode); configurationSourceSection.SelectedSource = configurationSourceNode; }
public void FindGrandChildNodeByType() { TempNode node = new TempNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child")); IList <ConfigurationNode> foundNodes = Hierarchy.FindNodesByType(typeof(TempNode)); Assert.AreEqual(2, foundNodes.Count); }
public void FindNodeByTypeForParentReturnsFirstNode() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child2")); node.AddNode(new TestNode("Child3")); ConfigurationNode foundNode = Hierarchy.FindNodeByType(ApplicationNode, typeof(TestNode)); Assert.AreEqual("Child", foundNode.Name); }
public void CanFindNodeById() { TestNode node = new TestNode("Child1"); ApplicationNode.AddNode(node); node.AddNode(new TestNode("Child11")); ConfigurationNode foundNode = Hierarchy.FindNodeById(node.Id); Assert.AreSame(node, foundNode); }
public void FindNodeByTypeForParentReturnsNullIfTypeNotFound() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child2")); node.AddNode(new TestNode("Child3")); ConfigurationNode foundNode = Hierarchy.FindNodeByType(ApplicationNode, typeof(Object)); Assert.IsNull(foundNode); }
public void FindNodeByNameForAParent() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child2")); node.AddNode(new TestNode("Child3")); ConfigurationNode foundNode = Hierarchy.FindNodeByName(node, "Child3"); Assert.AreEqual("Child3", foundNode.Name); }
public void SerializationUtilityCanSerializeConfigurationNode() { InstrumentationNode instrumentationNode = new InstrumentationNode(); ApplicationNode.AddNode(instrumentationNode); string serializedNode = SerializationUtility.SerializeToString(instrumentationNode, instrumentationNode.Hierarchy); string relativeNodePath = SerializationUtility.CreatePathRelativeToRootNode(instrumentationNode.Path, instrumentationNode.Hierarchy); Assert.AreEqual(relativeNodePath, serializedNode); }
public void FindNodeByNameForAParentWithNoNameReturnsNull() { TestNode node = new TestNode("Child"); ApplicationNode.AddNode(node); node.AddNode(new TempNode("Child2")); node.AddNode(new TestNode("Child3")); ConfigurationNode foundNode = Hierarchy.FindNodeByName(node, "Child4"); Assert.IsNull(foundNode); }