public void Test_AddMessageToClient(string ipAddressClient, int maskClient, string actualResult) { var client = new Client(ipAddressClient, maskClient); _messageStore.AddMessageToClient(actualResult, client); var result = _messageStore.ClientMessageDictionary[client][0]; Assert.AreEqual(result, actualResult); }
public void Test_SendMessage_ThrowArgumentException(string exceptionMessage, string ipAddress, int mask, string message) { string ipAddressServer = "192.168.4.5"; int maskServer = 56; var messageStore = new MessageStore(); var networkElements = new List <NetworkElement>() { new Server(ipAddressServer, maskServer), _client }; ((Server)networkElements[0]).AddedMessageToClient += (string message, Client client) => { messageStore.AddMessageToClient(message, client); }; Assert.That(() => _client.SendMessage(ipAddress, mask, message, networkElements), Throws.ArgumentException.With.Message.EqualTo(exceptionMessage)); }
public void Test_SendMessage(string ipAddress, int mask, string actualResult) { var messageStore = new MessageStore(); var networkElements = new List <NetworkElement>() { new Server(ipAddress, mask), _client }; ((Server)networkElements[0]).AddedMessageToClient += (string message, Client client) => { messageStore.AddMessageToClient(message, client); }; _client.SendMessage(ipAddress, mask, actualResult, networkElements); string result = messageStore.ClientMessageDictionary[_client][0]; Assert.AreEqual(result, actualResult); }