Exemplo n.º 1
0
        private DataTransferResult RetrieveDataForPeriod(
            TimeSpan timeLimit,
            string testName)
        {
            var fac    = SerilogHelper.GetLoggerFactory();
            var logger = fac.CreateLogger(testName);

            using (var device = DeviceHelper.GetFirstSuitableDevice(fac))
            {
                var result = DataTransferTestHelper.RetrievePpgDataForPeriod(device, timeLimit, logger);

                var samplesCount = result.Packages.Sum(p => p.Samples.Length);

                _logger.LogInformation($"Time:     {result.ActualRuntime.TotalSeconds} seconds");
                _logger.LogInformation($"Packages: {result.Packages.Count}");
                _logger.LogInformation($"Samples:  {samplesCount}");

                var actualSamplingRate = samplesCount / result.ActualRuntime.TotalSeconds;

                actualSamplingRate.ShouldBe(400, 400 * 0.01);

                // Checkpoints
                return(result);
            }
        }
        public void DataTransfer_SamplingRate_Repeat_2x5s()
        {
            {
                var result       = DataTransferTestHelper.RetrievePpgDataForPeriod(_device, TimeSpan.FromSeconds(5), _logger);
                var totalSamples = result.Packages.Sum(p => p.Samples.Length);

                // Checkpoint 3
                Assert.That(
                    totalSamples,
                    Is.EqualTo(SamplingRate * result.ActualRuntime.TotalSeconds)
                    .Within(6)
                    .Percent
                    );
            }
            System.Threading.Thread.Sleep(500);

            {
                var result       = DataTransferTestHelper.RetrievePpgDataForPeriod(_device, TimeSpan.FromSeconds(5), _logger);
                var totalSamples = result.Packages.Sum(p => p.Samples.Length);

                // Checkpoint 3
                Assert.That(
                    totalSamples,
                    Is.EqualTo(SamplingRate * result.ActualRuntime.TotalSeconds)
                    .Within(6)
                    .Percent
                    );
            }
        }
Exemplo n.º 3
0
        public void DataTransfer_Smoke_1s()
        {
            var timeLimit = TimeSpan.FromSeconds(1);

            var result = DataTransferTestHelper.RetrievePpgDataForPeriod(_device, timeLimit, _logger);

            // Checkpoint
            result.Packages.Count.ShouldBeGreaterThan(0);
        }