Exemple #1
0
        public void ActorMustNotAcceptMessagesWithoutAuthentication()
        {
            //setup
            var shardRegionObjectProbe = CreateTestProbe();
            var replyToProbe           = CreateTestProbe();
            var testeeRef         = Sys.ActorOf(Props.Create(() => new ClientTwinActor(defaultSocketProbe, defaultAuthenticationProbe, defaultEndpoint, shardRegionObjectProbe, defaultObjectRegionArea)));
            var clientPingMessage = new ClientPingMessage();

            //execute
            testeeRef.Tell(new UdpTransferFrame(FrameType.ClientPing, clientPingMessage.Serialize()));

            //verify
            shardRegionObjectProbe.ExpectNoMsg();
        }
Exemple #2
0
        public void ActorMustAcceptMessagesAfterAuthentication()
        {
            //setup
            var authenticationProbe = CreateTestProbe();
            var clientSocketProbe   = CreateTestProbe();
            var testeeRef           = CreateAuthenticatedActor(authenticationProbe, clientSocketProbe);
            var clientPingMessage   = new ClientPingMessage();

            //execute - authentication actor response
            testeeRef.Tell(new UdpTransferFrame(FrameType.ClientPing, clientPingMessage.Serialize()));

            //verify
            clientSocketProbe.ExpectMsg <Udp.Send>(s =>
            {
                var msg = new UdpTransferFrame(s.Payload.ToArray());
                Assert.Equal(FrameType.ServerPong, msg.Type);
            });
        }