public void Should_map_sucessfully() { string hostname = "hostname"; var client = "someClient"; var freq = 100; var configMapper = new ConfigMapper(hostname, stop, dataClientFactory, graphiteClientFactory, log); var taskSet = new List<SqlToGraphiteConfigTemplatesWorkItemsTaskSet>(); var x = new SqlToGraphiteConfigTemplatesWorkItemsTaskSet { frequency = freq.ToString(), Task = new SqlToGraphiteConfigTemplatesWorkItemsTaskSetTask[1] }; x.Task[0] = new SqlToGraphiteConfigTemplatesWorkItemsTaskSetTask { client = client, connectionstring = "cs", name = "name", path = "path", port = "1234", sql = "sql", type = "type" }; taskSet.Add(x); var clients = new GraphiteClients(); clients.Add(client, "1234"); var taskList = configMapper.Map(taskSet, clients); Assert.That(taskList.Count, Is.EqualTo(1)); Assert.That(taskList[0].Frequency, Is.EqualTo(freq)); Assert.That(taskList[0].Tasks.Count, Is.EqualTo(1)); Assert.That(taskList[0].Tasks[0].GetType(), Is.EqualTo(typeof(Task))); }
public void Should_throw_ClientNotFoundException_as_client_is_not_known() { var name = "name"; var graphiteClients = new GraphiteClients(); graphiteClients.Add(name, "1234"); var ex = Assert.Throws<ClientNotFoundException>(() => graphiteClients.Get("notFound")); Assert.That(ex.Message, Is.EqualTo("Client notFound is not known add this into the conifiguration xml")); }
public void Should_not_care_about_client_name_case() { var name = "name"; var graphiteClients = new GraphiteClients(); graphiteClients.Add(name, "1234"); var client = graphiteClients.Get("NaMe"); Assert.That(client.Name, Is.EqualTo(name)); Assert.That(client.Port, Is.EqualTo(1234)); }
public void Should_Add_client() { var name = "name"; var graphiteClients = new GraphiteClients(); graphiteClients.Add(name, "1234"); var client = graphiteClients.Get(name); Assert.That(client.Name, Is.EqualTo(name)); Assert.That(client.Port, Is.EqualTo(1234)); }