public override void ExtraSetup() { serverAuthenticator = serverGo.AddComponent <NetworkAuthenticationImpl>(); clientAuthenticator = clientGo.AddComponent <NetworkAuthenticationImpl>(); server.authenticator = serverAuthenticator; client.authenticator = clientAuthenticator; }
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; }
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()))); }
public override void ExtraSetup() { testAuthenticator = networkManagerGo.AddComponent <NetworkAuthenticationImpl>(); server.authenticator = testAuthenticator; client.authenticator = testAuthenticator; }