Esempio n. 1
0
        public static Envelope[] ReceiveItemsOfType <T>(
            this TelemetryHttpListenerObservable listener,
            int timeOut)
        {
            var result = listener
                         .Where(item => (item is T))
                         .TakeUntil(DateTimeOffset.UtcNow.AddMilliseconds(timeOut))
                         .ToEnumerable()
                         .ToArray();

            return(result);
        }
Esempio n. 2
0
        public static Envelope[] ReceiveItemsOfType <T>(
            this TelemetryHttpListenerObservable listener,
            int count,
            int timeOut)
        {
            var result = listener
                         .Where(item => (item is T))
                         .TakeUntil(DateTimeOffset.UtcNow.AddMilliseconds(timeOut))
                         .Take(count)
                         .ToEnumerable()
                         .ToArray();

            if (result.Length != count)
            {
                throw new InvalidDataException("Incorrect number of items. Expected: " + count + " Received: " + result.Length);
            }

            return(result);
        }