public void Should_get_number_of_tags_in_buffer() { using (var r = new SerialReader(TestSettings.Instance.GetConnection())) { r.GetNumberOfTagsInBuffer().Wait(); } }
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); } }