public void With_AutomataConfigurationHander_throws_exception_when_section_is_null() { var automataConfigurationHandler = new ConfigurationHandler(); Assert.ThrowsException <ArgumentNullException>(() => { object x = automataConfigurationHandler.Create(null, null, null); }); }
public void With_AutomataConfigurationHander_contains_one_taskgroup() { string section = @"<configuration><automata><taskgroups><taskgroup name=""Accounting"" logsink=""Null"" active=""true""><task name=""null1"" type=""Automations.NullTask, Automations"" active=""true""/></taskgroup></taskgroups><logsinks><logsink name=""Null"" type=""LogSinks.Null, LogSinks"" /></logsinks></automata></configuration>"; var xdoc = new XmlDocument(); xdoc.LoadXml(section); var node = xdoc.DocumentElement.SelectSingleNode("automata"); var automataConfigurationHandler = new ConfigurationHandler(); var x = (Configuration.AutomataConfiguration)automataConfigurationHandler.Create(null, null, node); Assert.AreEqual(x.TaskGroups.Length, 1); }
public void With_AutomataConfigurationHander_contains_one_logsink_configuration_with_additional_parameters() { string section = @"<configuration><automata><logsinks><logsink name=""Event"" type=""LogSinks.SystemEventLog, LogSinks""><param name=""Source"" values=""eventsource"" /></logsink></logsinks></automata></configuration>"; var xdoc = new XmlDocument(); xdoc.LoadXml(section); var node = xdoc.DocumentElement.SelectSingleNode("automata"); var automataConfigurationHandler = new ConfigurationHandler(); var x = (Configuration.AutomataConfiguration)automataConfigurationHandler.Create(null, null, node); Assert.AreEqual(x.LogSinks[0].Parameters.Count, 1); }
public void With_AutomataConfigurationHander_contains_one_logsink_configuration_with_type() { string section = @"<configuration><automata><logsinks><logsink name=""Null"" type=""LogSinks.Null, LogSinks"" /></logsinks></automata></configuration>"; var xdoc = new XmlDocument(); xdoc.LoadXml(section); var node = xdoc.DocumentElement.SelectSingleNode("automata"); var automataConfigurationHandler = new ConfigurationHandler(); var x = (Configuration.AutomataConfiguration)automataConfigurationHandler.Create(null, null, node); Assert.AreEqual(x.LogSinks[0].LogSink, Type.GetType("LogSinks.Null, LogSinks")); }
public void With_AutomataConfigurationHander_throw_exception_is_task_does_not_have_a_type() { string section = @"<configuration><automata><taskgroups><taskgroup name=""Accounting"" logsink=""Null"" active=""true""><task name=""null1"" type=""Automata.AutomationTasks.MisspelledAutomationTask, Automata"" active=""true""/></taskgroup></taskgroups><logsinks><logsink name=""Null"" type=""LogSinks.Null, LogSinks"" /></logsinks></automata></configuration>"; var xdoc = new XmlDocument(); xdoc.LoadXml(section); var node = xdoc.DocumentElement.SelectSingleNode("automata"); var automataConfigurationHandler = new ConfigurationHandler(); Assert.ThrowsException <ArgumentException>(() => { var x = (Configuration.AutomataConfiguration)automataConfigurationHandler.Create(null, null, node); }); }