Esempio n. 1
0
        public async Task Recover_from_tags_subscriber_error()
        {
            Proto.Dispose();
            tagStream = new Subject <Tag>();
            var p = new AlienReaderProtocol(receiveTimeout: int.MaxValue);

            p.ConnectAndLogin(Host, Port, "alien", "password").Wait(2000).Should().BeTrue();
            p.StartTagPolling(tagStream, errorStream, heartbeatStream).Wait(2000).Should().BeTrue();
            var doThrow       = false;
            var badSubscriber = tagStream.Subscribe(x =>
            {
                if (doThrow)
                {
                    throw new Exception();
                }
            });

            tagStream.Subscribe(tags.Add, ex => throw ex, () => completed = true);

            await p.Api.AntennaSequence("0");

            await new Timing().ExpectAsync(() => tags.Count > 100);
            errors.Count.Should().Be(0);
            doThrow = true;

            await new Timing().ExpectAsync(() => errors.Count > 0);
            errors[0].Should().BeOfType <Exception>();
            tags.Clear();
            (await new Timing().Timeout(2000).WaitAsync(() => tags.Count > 0)).Should().BeFalse();
            badSubscriber.Dispose();
            await new Timing().ExpectAsync(() => tags.Count > 100);
        }
Esempio n. 2
0
        public async Task Check_known_tags()
        {
            await Proto.Api.AntennaSequence("0");

            await Proto.Api.RFAttenuation(50);

            await Proto.Api.AcqG2AntennaCombine(false);

            await new Timing().ExpectAsync(() => tags.Count > 500);
            Proto.Dispose();

            var dict      = tags.GroupBy(x => x.TagId).ToDictionary(x => x.Key, x => x.ToList());
            var foundTags = dict.Keys.Intersect(Settings.KnownTagIds).ToList();

            foundTags.Count.Should().BeGreaterOrEqualTo(2);
            foreach (var tagId in foundTags)
            {
                dict[tagId].Count.Should().BeGreaterThan(50);
            }
            msgs.Count.Should().Be(0);
            if (errors.Count > 0)
            {
                errors[0].ToString().Should().BeNull();
            }
            errors.Count.Should().Be(0);
        }
Esempio n. 3
0
 public void LoginWithWrongPassword()
 {
     Proto?.Dispose();
     Proto = new AlienReaderProtocol();
     Assert.Throws <AggregateException>(() => Proto.ConnectAndLogin(Host, Port, "alien", "password1").Wait())
     .InnerException.Should().BeOfType <LoginFailedException>();
 }
Esempio n. 4
0
        public async Task Start_and_stop_stream()
        {
            await Proto.Api.AntennaSequence("0");

            await new Timing().ExpectAsync(() => tags.Count > 100);
            Proto.Dispose();
            completed.Should().BeFalse();
            msgs.Count.Should().Be(0);
            errors.Count.Should().Be(0);
        }