public void AddNetworkConnector_SendMessage_Test() { bool eventFired = false; Guid clientGuid = new Guid(); //Arrange NetworkConnectSystem system = NetworkConnectSystem.GetInstance(); var connector = new StubINetworkConnector() { SendMessageRemResMessageGuid = (message, clientID) => { return(true); }, IsClientRegisteredGuid = (clientID) => clientGuid == clientID }; system.AddNetworkConnector(connector); system.MessageReceived += (message, clientID) => { eventFired = true; }; //network system start system.Start(); //receive message from network connector connector.MessageReceivedEvent(new AddWatchRule(), clientGuid); //Assert //Send message Back Assert.IsTrue(eventFired); //Assert.IsTrue(system.SendMessage(new OperationStatus(), clientGuid)); system.Stop(); }
/// <summary> /// Starts the systems. /// </summary> private void StartSystems() { //first because to initialize the save config rules watchSystem.StartWatchSystem(); //second to be prepared for incoming messages executionSystem.Start(); //third service ready for incoming messages networkSystem.Start(); }
public void AddNetworkConnector_StartUp_Test() { bool eventFired = false; Guid clientGuid = new Guid(); //Arrange NetworkConnectSystem system = NetworkConnectSystem.GetInstance(); var connector = new StubINetworkConnector(); system.AddNetworkConnector(connector); system.MessageReceived += (message, clientID) => { eventFired = true; }; //network system start system.Start(); //receive message from network connector connector.MessageReceivedEvent(new AddWatchRule(), clientGuid); //Assert Assert.IsTrue(eventFired); system.Stop(); }