Пример #1
0
        public async Task should_send_client_registration()
        {
            _server.Given(
                Request
                .Create()
                .WithPath("/client/register")
                .WithHeader("UNLEASH-APPNAME", "test-app")
                .UsingGet())
            .RespondWith(
                Response
                .Create()
                .WithStatusCode(200)
                );

            var uri    = new Uri("http://localhost:" + _server.Ports.First());
            var config = UnleashConfig.TheBuilder().AppName("test-app").UnleashAPI(uri).Build();

            var sender = new UnleashMetricsSender(config);
            await sender.RegisterClient(new ClientRegistration(config, DateTime.Now, new HashSet <string>()));
        }
Пример #2
0
        public async Task should_send_client_metrics()
        {
            _server.Given(
                Request
                .Create()
                .WithPath("/client/metrics")
                .WithHeader("UNLEASH-APPNAME", "test-app")
                .UsingGet())
            .RespondWith(
                Response
                .Create()
                .WithStatusCode(200)
                );

            var uri    = new Uri("http://localhost:" + _server.Ports.First());
            var config = UnleashConfig.TheBuilder().AppName("test-app").UnleashAPI(uri).Build();

            var sender  = new UnleashMetricsSender(config);
            var bucket  = new MetricsBucket();
            var metrics = new ClientMetrics(config, bucket);
            await sender.SendMetrics(metrics);
        }