public void Should_run_inventory_with_buffer_and_get_response(ConnectionType connectionType)
        {
            using (var r = new SerialReader(TestSettings.Instance.GetConnection(connectionType)))
            {
                var totalTagsBuffered = 0;
                var lastInventoryAgg  = 0;
                new Timing()
                .Context("Failed to read 50 tags")
                .Expect(() =>
                {
                    var res           = r.TagInventoryWithMemoryBuffer().Result;
                    totalTagsBuffered = res.TagsInBuffer;
                    lastInventoryAgg += res.TagsInLastInventory;
                    return(lastInventoryAgg > 50);
                });
                lastInventoryAgg.Should().BeGreaterThan(50);
                totalTagsBuffered.Should().BeInRange(1, 100);

                r.GetNumberOfTagsInBuffer().Result.Should().Be(totalTagsBuffered);
                var tagInBuffer = r.GetTagsFromBuffer().Result;
                tagInBuffer.Tags.Count.Should().Be(totalTagsBuffered);
                tagInBuffer.Tags.Select(x => x.TagId)
                .Intersect(TestSettings.Instance.GetKnownTagIds)
                .Count()
                .Should().BeGreaterOrEqualTo(1,
                                             $"Should find at least one tag from known tags list. " +
                                             $"Actually found: {string.Join(", ", tagInBuffer.Tags.Select(x => x.TagId))}");
                tagInBuffer.Tags[0].Antenna.Should().Be(0);
                tagInBuffer.Tags[0].Rssi.Should().BeGreaterThan(0);
                tagInBuffer.Tags[0].LastSeenTime.Should().BeAfter(DateTime.UtcNow.Date);
                tagInBuffer.Tags[0].DiscoveryTime.Should().BeAfter(DateTime.UtcNow.Date);
            }
        }
Exemple #2
0
        public void Should_get_tags_from_buffer_empty()
        {
            using var r = new SerialReader(TestSettings.Instance.GetConnection());
            r.ClearBuffer().Wait();
            var buffer = r.GetTagsFromBuffer().Result;

            buffer.Tags.Count.Should().Be(0);
        }