Пример #1
0
        public async Task ShouldTriggerKeepAlive()
        {
            using (LoopFixture fixture = new LoopFixture())
                using (LoopSession session = await fixture.Start())
                {
                    Trigger handler = Trigger.Bind(ref fixture.Hooks.OnKeepAliveReceived, data =>
                    {
                        data.Peer.Should().NotBeNull();
                    });

                    session.Client.Send(fixture.Samples.KeepAlive, null);
                    handler.Wait().Should().BeTrue();
                }
        }
Пример #2
0
        public async Task ShouldTriggerMessageIgnored()
        {
            using (LoopFixture fixture = new LoopFixture())
                using (LoopSession session = await fixture.Start())
                {
                    Trigger handler = Trigger.Bind(ref fixture.Hooks.OnMessageIgnored, data =>
                    {
                        data.Peer.Should().NotBeNull();
                        data.Identifier.Should().Be(0x02);
                        data.Payload.Should().NotBeNull();
                    });

                    session.Client.Send(fixture.Samples.Unknown, null);
                    handler.Wait().Should().BeTrue();
                }
        }