Пример #1
0
        public void ctor_100_5()
        {
            var meter = new FrequencyMeter(200, TimeSpan.FromSeconds(5));

            Observable2.Interval(TimeSpan.FromMilliseconds(30))
            .Select(_ => meter.RecordLap())
            .Subscribe(Console.WriteLine);

            Thread.Sleep(3000);
        }
Пример #2
0
        public void ctor_1()
        {
            var filter = new FrequencyFilter(25);
            var meter  = new FrequencyMeter();

            Observable2.Interval(TimeSpan.FromMilliseconds(20))
            .Where(_ => filter.CheckLap())
            .Do(_ => meter.RecordLap())
            .Subscribe(Console.WriteLine);

            Thread.Sleep(3000);
            Assert.IsTrue(meter.Frequency > 24);
            Assert.IsTrue(meter.Frequency <= 25);
        }