public void Publishing_state_supports_asynch_mode()
        {
            var host = Guid.NewGuid().ToString();
            const string serviceNameRoot = "UdpClientAsync#";
            Guid.NewGuid().ToString();

            IEnumerable<EventRecord> results;

            var states = from idx in Enumerable.Range(1, 100)
                         let state =
                             new EventRecord(host: host,
                                            service: serviceNameRoot + idx,
                                            state: "ok", metric: idx,
                                            timeToLiveInSeconds: 10)
                         group state by idx%10
                         into batches
                         select batches;

            var udpClient = new CompositeClient();
            var tasks = states.Select(s => udpClient.SendAsync(s.ToArray())).ToArray();
            Task.WaitAll(tasks);
            Thread.Sleep(2000);
            using (var tcpClient = new CompositeClient())
            {
                var query = string.Format("service=~ \"{0}%\"", serviceNameRoot);
                results = tcpClient.QueryAsync(query).Result.ToList();
            }
            Assert.That(results.Count(), Is.EqualTo(100));
        }
        public void Should_convert_time_to_unix_epoch_seconds()
        {
            var time = DateTime.UtcNow;
            int expectedTimestamp = (int)(time - new DateTime(1970, 1, 1)).TotalSeconds;

            List<EventRecord> results;
            using (var client = new CompositeClient(maxDatagramSize: 0))
            {
                const string serviceName = "Should_convert_time_to_unix_epoch_seconds";
                client.SendAsync(host: "tests",
                                 service: serviceName,
                                 state: "ok",
                                 timestamp: time).Wait();

                results = client.Query(string.Format("service=\"{0}\"", serviceName)).ToList();

            }
            Assert.That(results.Any());
            Assert.That(results.Single().Time, Is.EqualTo(expectedTimestamp));
        }