public override void ExtraSetup()
 {
     serverAuthenticator  = serverGo.AddComponent <NetworkAuthenticationImpl>();
     clientAuthenticator  = clientGo.AddComponent <NetworkAuthenticationImpl>();
     server.authenticator = serverAuthenticator;
     client.authenticator = clientAuthenticator;
 }
Esempio n. 2
0
        public override void ExtraSetup()
        {
            serverAuthenticator  = serverGo.AddComponent <NetworkAuthenticationImpl>();
            clientAuthenticator  = clientGo.AddComponent <NetworkAuthenticationImpl>();
            server.authenticator = serverAuthenticator;
            client.authenticator = clientAuthenticator;

            serverMockMethod = Substitute.For <Action <INetworkConnection> >();
            serverAuthenticator.OnServerAuthenticated += serverMockMethod;

            clientMockMethod = Substitute.For <Action <INetworkConnection> >();
            clientAuthenticator.OnClientAuthenticated += clientMockMethod;
        }
Esempio n. 3
0
        public void ServiceAuthFailTest()
        {
            var networkOperations = Substitute.For <INetworkOperations>();
            var serviceOperations = Substitute.For <IServiceOperations>();

            var networkId  = Identity.Next();
            var networkKey = Crypto.GenerateSafeRandomToken();

            var serviceId = Identity.Next();
            var apiKey    = Crypto.GenerateSafeRandomToken();

            networkOperations.Get(networkId).Returns(TestDataCreator.Network(networkId, networkKey, null, serviceId, null, null));
            serviceOperations.Get(serviceId).Returns(TestDataCreator.Service(serviceId, apiKey, null, null));

            var networkAuthenticator = new NetworkAuthenticator(networkOperations, serviceOperations);

            Assert.IsFalse(networkAuthenticator.Authenticate(new AuthenticationParameters(networkId, Identity.Next())));
        }
Esempio n. 4
0
 public override void ExtraSetup()
 {
     testAuthenticator    = networkManagerGo.AddComponent <NetworkAuthenticationImpl>();
     server.authenticator = testAuthenticator;
     client.authenticator = testAuthenticator;
 }