public void Should_throw_exception_if_unknown_type()
 {
     var graphiteParams = new GraphiteParams("hostname", 8125);
     var taskParams = new TaskParams("path", "sql", "cs", "wmi", "name", "unknown");
     var ex = Assert.Throws<UnknownGraphiteClientTypeException>(() => clientFactory.Create(graphiteParams, taskParams));
     Assert.That(ex.Message, Is.EqualTo("Unknown Graphite Client Type: unknown"));
 }
        public void Should_create_native_graphitetcp_client()
        {
            var taskParams = new TaskParams("path", "sql", "cs", "wmi", "name", "graphitetcp");
            var graphiteParams = new GraphiteParams("hostname", 8125);
            var o = clientFactory.Create(graphiteParams, taskParams);

            Assert.That(o, Is.Not.Null);
            Assert.That(o, Is.TypeOf(typeof(GraphiteTcpClient)));
            Assert.That(o, Is.TypeOf<GraphiteTcpClient>());
        }
        public void Should_create_statsd_client_uppercase()
        {
            var graphiteParams = new GraphiteParams("localhost", 8125);
            var taskParams = new TaskParams("path", "sql", "cs", "wmi", "name", "STATSduDp");
            var o = clientFactory.Create(graphiteParams, taskParams);

            Assert.That(o, Is.Not.Null);
            Assert.That(o, Is.TypeOf(typeof(StatsdClient)));
            Assert.That(o, Is.TypeOf<StatsdClient>());
        }
Пример #4
0
 public void Should_run_task_sending_one_result()
 {
     var result = MockRepository.GenerateMock<IResult>();
     var resultList = new List<IResult> { result };
     var param = new TaskParams("path", "sql", "cs", "SqlServer", "name", "client");
     this.dataClientFactory.Expect(x => x.Create(param)).Return(this.sqlClient);
     this.sqlClient.Expect(x => x.Get()).Return(resultList);
     statsClient.Expect(x => x.Send(result));
     var graphiteParams = new GraphiteParams("host", 1234);
     this.graphiteClientFactory.Expect(x => x.Create(graphiteParams, param)).Return(this.statsClient);
     ITask task = new Task(param, this.dataClientFactory, this.graphiteClientFactory, graphiteParams, log);
     //Test
     task.Process();
     //Assert
     this.sqlClient.VerifyAllExpectations();
     this.dataClientFactory.VerifyAllExpectations();
     this.graphiteClientFactory.VerifyAllExpectations();
     statsClient.VerifyAllExpectations();
 }