Exemple #1
0
        public async Task Simulation_Connect()
        {
            var endpoint = simulation.RegisterConnection("InstanceID");

            var monitor = new NetworkEventMonitor(endpoint);

            await simulation.Hub.Broadcast(new NetworkEvent());

            Assert.AreEqual(1, monitor.MessageCount);
        }
Exemple #2
0
        public async Task <ConnectionState> Connect(InstanceInfo registration)
        {
            await CallService();

            endpoint             = simulation.RegisterConnection(InstanceID);
            endpoint.EventFired += FireEventReceived;

            // TODO remove MonitoredAccounts from registration
            //await Monitor(registration.MonitoredAccounts);

            switch (ServiceState)
            {
            case ServiceState.Operational:
                return(ConnectionState.Online);

            case ServiceState.Limited:
                return(ConnectionState.Connected);

            case ServiceState.Down:
            default:
                throw new ApplicationException();
            }
        }