public void Should_throw_exception_if_graphite_client_is_unknown() { string clientName = "notKnown"; string jobName = "someJob"; var job = new WmiClient(); var msg = "some exception message"; job.ClientName = clientName; job.Name = jobName; configRepository.Expect(x => x.GetClient(clientName)).Throw(new ClientNotFoundException(msg)); configRepository.Expect(x => x.GetJob(jobName)).Return(job); string hostname = "hostname"; var configMapper = new ConfigMapper(hostname, this.stop, this.dataClientFactory, this.graphiteClientFactory, this.log, configRepository); var taskSets = new List<TaskSet>(); var taskSet = new TaskSet { Frequency = 100, Tasks = new List<Task>() }; var t = new Task { JobName = jobName }; taskSet.Tasks.Add(t); taskSets.Add(taskSet); //Test var ex = Assert.Throws<ClientNotFoundException>(() => configMapper.Map(taskSets)); //Assert Assert.That(ex.Message, Is.EqualTo(msg)); }
private Template CreateSingleRoleAndJob(string jobName, int frequency, string roleName) { var ts = new TaskSet { Frequency = frequency, Tasks = new List<Task>() }; var task = new Task { JobName = jobName }; ts.Tasks.Add(task); var template = new Template(); var wi = new WorkItems { RoleName = roleName, TaskSet = new List<TaskSet>() }; wi.TaskSet.Add(ts); var wilist = new List<WorkItems> { wi }; template.WorkItems = wilist; this.config.Templates.Add(template); return template; }
private Template CreateMultipoleRolesAndJobs(string jobName, string jobName1, int frequency, int frequency1, string roleName) { var ts1 = new TaskSet { Frequency = frequency, Tasks = new List<Task>() }; var ts2 = new TaskSet { Frequency = frequency1, Tasks = new List<Task>() }; var task = new Task { JobName = jobName }; ts1.Tasks.Add(task); var task1 = new Task { JobName = jobName1 }; ts2.Tasks.Add(task1); var template = new Template(); var wi = new WorkItems { RoleName = roleName, TaskSet = new List<TaskSet>() }; wi.TaskSet.Add(ts1); wi.TaskSet.Add(ts2); var wilist = new List<WorkItems> { wi }; template.WorkItems = wilist; this.config.Templates.Add(template); return template; }
private static void AssertThatTaskEqualToTaskProperty(TaskDetails t, Task task) { Assert.Fail("commented out shit"); //Assert.That(task.client, Is.EqualTo(t.Client)); //Assert.That(task.connectionstring, Is.EqualTo(t.Connectionstring)); //Assert.That(task.name, Is.EqualTo(t.Name)); //Assert.That(task.path, Is.EqualTo(t.Path)); //Assert.That(task.port, Is.EqualTo(t.Port)); //Assert.That(task.sql, Is.EqualTo(t.Sql)); //Assert.That(task.type, Is.EqualTo(t.Type)); }
private static WorkItems CreateWorkItems(string jobName, string roleName, int freq) { var wi = new WorkItems { RoleName = roleName }; var ts = new TaskSet { Frequency = freq }; var task = new Task { JobName = jobName }; ts.Tasks.Add(task); wi.TaskSet.Add(ts); return wi; }
private bool CheckJobNameExists(Task task) { bool rtn = false; foreach (var job in this.Jobs) { if (job.Name == task.JobName) { rtn = true; } } return rtn; }